Jump to content

Help, with sessions, and repeating banners


Yojimbo

Recommended Posts

Hello!

 

I need some help, regarding PHP, and I thought that I should ask you :3

 

Anyway, I'm working on a website, with a .swf banner, however, I don't want it to animate every single time I press a link.

 

I asked one of my friends, who works with webdesigning etc.

 

He thought I should use:

session_start();

 

if(!isset($_SESSION['firstvisit']) && $_SESSION['firstvisit'] != "true"){

//Draw my first flash..

}else{

//Draw my second flash, as this is not the first time the user visited the site..

}

 

$_SESSION['firstvisit'] = "true";

 

But I can't get it to work, it always animates the first one.

 

have also gotten this suggestion:

 

You could maybe do it by setting a cookie... Like:

 

if(!isset($_COOKIE['firstvisit'])){

$_SESSION['firstvisit'] = "true";

}

else{

$_SESSION['firstvisit'] = "false";

}

 

if($_SESSION['firstvisit'] == "true"){

/** whatever code for your "first visit" banner

* anything else you want to add before this statement finishes

* THEN when it's finished, set your cookie */

setcookie("firstvisit", "first visit", time()+60*60*24*30);

}

else{

/** whatever would be here if the cookie is already set */

}

 

Neither of them work, and I'm completely in the dark on sessions and cookies.

 

Anyone out there know what I should do?

  • 6 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.