note 60090 added to function.setcookie
| From: | manhon824 at gmail dot com | Date: | Mon, 26 Dec 2005 12:31:42 +0000 |
| Subject: | note 60090 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-100726@lists.php.net to get a copy of this message | ||
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!
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60090
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60090&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60090&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60090&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60090&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60090&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60090&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60090&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60090&report=yes
Search -- http://master.php.net/manage/user-notes.php