Basically, I have an entry in my database for a list of IP addresses, each time a page is viewed I want to get current IP, check it with the current list in the database. If not present, add it to the database and update another entry in the table as a counter. If present, do NOT update the other entry in the table.
Like a UNIQUE PAGE VIEW that counts views. Here is what I have so far, but it does not work… error on mysql_fetch_array… I believe my variables are cross matching… plus, do I really need to get server IP twice???
Any help would be greatly appreciated…
// I have an entry in the table to store IPs (ad_ip)
// and I have one for counting views (ad_views)
$getip = $_server["REMOTE_ADDR"];
$check_ips = "select * from $ad_ip";
$ad_ip = mysql_query($check_ips);
$check_ips = mysql_fetch_array($ad_ip);
foreach($ad_ips as $ips) {
$ip = $_server["REMOTE_ADDR"];
if($ip == $ips) {
$s = "UPDATE $ads_tbl set ad_views=ad_views+0 where ad_id=$ad_id";
$result1=q($s);
}
else
$s = "UPDATE $ads_tbl set ad_views=ad_views+1 where ad_id=$ad_id";
$result1=q($s);
$ad_ip = "UPDATE $ads_tbl set ad_ip=$ip";
}