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?

Link to comment
Share on other sites

  • 6 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.