Hey guys, Is there a php command that allows when a person goes to a certain page, it executes a function? Would that be exec(); function? Thanks, Majo0od
Surely just placing the code you want executed on the page they go to, would be the most efficient way?
well im creating a view counter, and trying to make it unique, and this is what I have.... <?php include '../../sql/dbcon.php'; $ip = $_SERVER['REMOTE_ADDR']; $sessionip = $_SESSION['ip']; $_SESSION['ip'] = $ip; $count=0; $count=$count+1; $count++; echo $count." <b>Views</b>"; $usql="update videos set Views=".$count; if($vidinfo[4] == $_SERVER["REQUEST_URI"]); { if(!mysql_query($usql)) { echo mysql_errno().":"; echo mysql_error(); } } ?> Code (markup): where the count ++ is, I want it to count views when ever someone comes on the page, like +1 for each view. The reason why I have the IP address is because im trying to do after each 5 minutes of someone's IP address, it can counts a view again, so people don't cheat.... so thats a problem too... I also tried mktime() function, but that didn't work, so I deleted it... Help please?
Have it place a cookie on there that expires in 5 minutes. Before adding check if the cookie exists. Or you could use sessions.
I third the sessions, add sessions by placing sessions in the middle of the code with the execute function