Yojimbo Posted May 18, 2009 Share Posted May 18, 2009 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 https://forums.phpfreaks.com/topic/158627-help-with-sessions-and-repeating-banners/ Share on other sites More sharing options...
felixtgomezjr Posted November 28, 2009 Share Posted November 28, 2009 try to use logical OR and instead of AND if(!isset($_SESSION['firstvisit']) || $_SESSION['firstvisit'] != "true"){ Link to comment https://forums.phpfreaks.com/topic/158627-help-with-sessions-and-repeating-banners/#findComment-966845 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.