aminnuto Posted February 18, 2007 Share Posted February 18, 2007 I have a file (in an include file) that I want to put on each webpage on my site. It loads a javascript hover window. BUT, I only want it to show up on the first page that a person sees when they come to my site (not necessarily the home page). Once they see the box, I dont want them to see it again as they navigate to through my site, but i want to make sure they see it at least once when they come to my site so i want to put it on each page. That way, when a search engine sends them to one page on my site, they see it but wont see it on every page they go to after that. I need code (i'm guessing a session cookie) that will print my include file if the session has not been set. Once its been set, do nothing. Does anyone know how I can do this? Quote Link to comment https://forums.phpfreaks.com/topic/38986-solved-help-need-php-cookie-code/ Share on other sites More sharing options...
aminnuto Posted February 18, 2007 Author Share Posted February 18, 2007 anyone??? Quote Link to comment https://forums.phpfreaks.com/topic/38986-solved-help-need-php-cookie-code/#findComment-187914 Share on other sites More sharing options...
redarrow Posted February 18, 2007 Share Posted February 18, 2007 use a poup once the user close the popup then another page is displayed. Quote Link to comment https://forums.phpfreaks.com/topic/38986-solved-help-need-php-cookie-code/#findComment-187924 Share on other sites More sharing options...
aminnuto Posted February 18, 2007 Author Share Posted February 18, 2007 let me clarify because I am also going to use this code to display other include files that are not popups... I need code that will set a session cookie that will display an .inc file if the session cookie is not set. If it is set, do nothing. Quote Link to comment https://forums.phpfreaks.com/topic/38986-solved-help-need-php-cookie-code/#findComment-187940 Share on other sites More sharing options...
marcus Posted February 18, 2007 Share Posted February 18, 2007 //to set the cookie setcookie(name,value,time); //to check if it exists if(isset($_COOKIE[name])){ return true; }else { return false; } Quote Link to comment https://forums.phpfreaks.com/topic/38986-solved-help-need-php-cookie-code/#findComment-187941 Share on other sites More sharing options...
aminnuto Posted February 18, 2007 Author Share Posted February 18, 2007 I'm a novice.. How would I insert this code into that code <?php require("/home/main/www/events/inc/SPECIAL1.inc"); ?> I want this code to print to the .php file if the cookie is not set. If it is set, do nothing. Quote Link to comment https://forums.phpfreaks.com/topic/38986-solved-help-need-php-cookie-code/#findComment-187957 Share on other sites More sharing options...
marcus Posted February 18, 2007 Share Posted February 18, 2007 Oh if(isset($_COOKIE[name])){ include('/home/main/www/events/inc/SPECIAL1.inc'); } Quote Link to comment https://forums.phpfreaks.com/topic/38986-solved-help-need-php-cookie-code/#findComment-187963 Share on other sites More sharing options...
aminnuto Posted February 18, 2007 Author Share Posted February 18, 2007 I'm missing something. This is the code in my php file <?php session_start(); if(isset($_SESSION[special])){ include('/home/main/www/events/inc/SPECIAL1.inc'); } ?> but it shows a blank page. Quote Link to comment https://forums.phpfreaks.com/topic/38986-solved-help-need-php-cookie-code/#findComment-187972 Share on other sites More sharing options...
marcus Posted February 18, 2007 Share Posted February 18, 2007 Did you define it? Quote Link to comment https://forums.phpfreaks.com/topic/38986-solved-help-need-php-cookie-code/#findComment-187974 Share on other sites More sharing options...
aminnuto Posted February 18, 2007 Author Share Posted February 18, 2007 define it? I need the exact code to put in my php file. Quote Link to comment https://forums.phpfreaks.com/topic/38986-solved-help-need-php-cookie-code/#findComment-187975 Share on other sites More sharing options...
aminnuto Posted February 18, 2007 Author Share Posted February 18, 2007 nevermind. i figured it out. thanks for your help. Quote Link to comment https://forums.phpfreaks.com/topic/38986-solved-help-need-php-cookie-code/#findComment-187998 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.