I need some help with cookies...
Is it possible to show a user a string only once every 24 hour? I.e. If ha has seen that string, ha has to wait 24h to see it again?
Thanks...
you cold trt somthing like a cookie with a time limit of 24 hours (76800 seconds) with some code like
if ($cookiename = "visit") { echo "you have been here";} else { echo "string"; }
somot like that might work
Ok, thank you.. I'll test it asap.. 🙂
Make sure you only set a cookie if one has not been set (or one does not exist, i.e. expired). Otherwise, every time the user visits the page, a new cookie with a 24-hour expiration is added whether he sees the message or not...
Originally posted by Smifffy you cold trt somthing like a cookie with a time limit of 24 hours (76800 seconds) with some code like if ($cookiename = "visit") { echo "you have been here";} else { echo "string"; } somot like that might work [/B]
Originally posted by Smifffy you cold trt somthing like a cookie with a time limit of 24 hours (76800 seconds) with some code like
somot like that might work [/B]
BTW, 24 hours ain't 76800 seconds.. It's 86400 😉
60 secs 60 mins 24 hours = 86400
The result..
$randnum = rand (1, 5); if ($randnum == "1") { if (!isset($eknpp)) { setcookie ("eknpp", "1",time()+86400); global $showad; $showad = "now"; } }