View Full Version : Display Content only once per session
medusa1
02-08-2009, 07:47 PM
Hi
I would like display a special content (banner) only one time per session can someone help me with the code please
<!-- Beginn Session code
my content
End Session Code -->
thanks in advanced
Dismounted
02-09-2009, 05:02 AM
The easiest way would be to set a temporary cookie, and check this cookie. However, this requires PHP coding on your part. I'm sure I've posted a snippet somewhere though.
Shamil.
02-09-2009, 10:01 AM
Here is a basic piece of PHP to do this.
Set the cookie...
setcookie("Cookie", '1', time()+3600, ".yoursite.com", 1); //Cookie will expire in an hour. Change to your needs...
Check to see if the cookie is set...
if($_COOKIE['Cookie'] == '1') {
echo 'You\'re not allowed to see this!;
}
else {
//Execute code as normal...
}
Ive not tested it but the basic princibles are there.
http://uk.php.net/manual/en/function.setcookie.php
Dismounted
02-09-2009, 10:05 AM
Inside vBulletin, the vbsetcookie() function should be used.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.