note 60090 deleted from function.setcookie by nlopess

From: Date: Mon, 26 Dec 2005 12:36:07 +0000
Subject: note 60090 deleted from function.setcookie by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-100727@lists.php.net to get a copy of this message
Note Submitter: manhon824 at gmail dot com ---- Autaully, you will face the time zone problem if someone who is not in the same time zone with your sever aceept your page. To solve the problem, you should save the time in cookie, eg $counter=time(); setcookie("apast","$counter",time()+3600*2400000); then you use the time difference method. $now=time(); $timediffer=$now-$_COOKIE['apast']; if ($timediffer<3600*24) { echo 'you cant query db more than 1 time in 1 hrs, this is to prevent some guy trying to damage the system, thank you for understanding.sorry for inconvenient!</font></p>'; require 'bottom.php'; exit; }; This is my way to solve the time zone problem. Hope that this will be useful!

« previous php.notes (#100727) next »