Posted 11 June 2006 - 08:14 PM
On my website i have this sms application which is beeing heavily used, so therefore i would like for the number of sent messages for each user to be 5 per day, and no more.
When a user sends an sms, he is redirected to a page that confirms that the message has been sent. That page is called sms-ok.php. On this page i would like to have a cookie based counter. I have found this little script that does the counting:
PHP - Cookie Example 1
<h1>Cookie Example 1</h1>
<font size=+2 face = verdana>
$visitcount = $HTTP_COOKIE_VARS["visits"];
if( $visitcount == "") $visitcount = 0;
print "This is visit number " . $visitcount;
Now, does anyone know how i can set the expiration time of this cookie to 24 hours?
And how would i be able to display a message on another page, when the counter has reached 5?
Any help is much appresiated
Posted 11 June 2006 - 08:52 PM
but if you insist on doing it this way, to display a message when the limit is reached simply do this:
//put your error message here
Posted 11 June 2006 - 09:11 PM
Well, using cookies just seems as the easiest way to go about it.
I would like to ask a few more questions if that's alright.
If i do not set an expiration time on the cookie, how long will it last??
The thing you mentioned about the database seems like a lot of work. I hope i'm not being too demanding, but would you care do explain a little bit on how do accomplish this?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users