$dbh = mysql_connect("sql11.pcextreme.nl", "37289egb", "orange75apple") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("37289egb"); //Statistics //Check if IP has been here before TODAY $check = mysql_fetch_object(mysql_query("SELECT * FROM em_stats WHERE sid = '" . $_SERVER['REMOTE_ADDR'] . "'")); //If so, (! is NOT empty) update row by turning up the hits +1 where date = today and sid = remote IP if(!empty($check->id)){ $update = mysql_query("UPDATE em_stats SET hits = '" . ($check->hits + 1) . "' WHERE sid = '" . $_SERVER['REMOTE_ADDR'] . "'"); }else{ //If NOT so, insert new row with new id, date, remote IP, hits and visits to 1 $insert = mysql_query("INSERT INTO em_stats (id, datum, sid, hits, visits) VALUES (null, '" . date("Y-m-d") . "', '" . $_SERVER['REMOTE_ADDR'] . "', '1', '1')"); } //Check if IP has been here before on another day than today $check = mysql_fetch_object(mysql_query("SELECT * FROM em_stats WHERE sid = '" . $_SERVER['REMOTE_ADDR'] . "'")); //If so update row by turning up the visits +1 where sid = remote IP set date to today if(date("Y-m-d") !== $check->datum){ $update = mysql_query("UPDATE em_stats SET visits = '" . ($check->visits + 1) . "', datum = '" . date("Y-m-d") . "' WHERE sid = '" . $_SERVER['REMOTE_ADDR'] . "'"); } ?>
|
Home | Alg.
Voorwaarden | Sitemap | Log-in | Disclaimer |
||
|
Over Visa2Canada | Over Canada | Nieuws | Agenda | FAQ | Contact | Links |
| |||||||||