iwannabeleet Posted January 14, 2008 Share Posted January 14, 2008 Okay I really need help with this one, I have a unique problem and cannot figure out the best solution. Lemme try and make this as brief as possible, and thank you VERY much in advance for those who actually read through this: THE SCENARIO: I have a website whose index page presents a quick Flash intro, then redirects to the main website. The website owner wants a javascript lytebox-style popup to display a particular photo once when the page is first visited, but only once. THE PROBLEM: When the user visits the main website page, the Javascript popup is triggered onLoad, but because the links on the page force a reload anytime they navigate around, the popup is displaying every time (ie index2.php?page=main, index2.php?page=contact, index2.php?=otherstuff). It is too late to change the basic structure of the site itself (hindsight is 20/20 ) THE SECOND PROBLEM: At first I tried having my flash intro redirect to something like 'index2.php?popup=1'. I thought I was being clever because then the only time the popup would show is if the URL had that popup variable set in $_GET. So once they navigate elsewhere, that $popup variable disappears. Unfortunately, if they navigate to a new page, and then click 'BACK' in their browser, it will send them back to the original URL with $popup still in there, so they see the popup a second time. I cannot figure out how to avoid that or how to remove $popup from the GET so when they click Back it doesn't show again. Seems like POST would have the same issue. POSSIBLE SOLUTIONS: 1) Cookies. Install a small session PHP cookie to check if the popup has displayed, if not, show it, if it has, do nothing. (I'm trying to avoid this). 2) Some kind of global-variable voodoo. I don't know if this is possible, but is there some kind of magic global variable that will retain its value site-wide between interpreter fire-ups? I guess not because that would eliminate the need for cookies in the first place? 3) Check the HTTP_REFERER. Ie, did we arrive at this page from the initial flash intro? If so, show the popup, if not, do nothing. Downside here: reliability -- will this even work consistently enough to be a viable solution? 4) ...? Okay so I know that was long winded but i wanted to try and sum up everything I've thought of. Am I missing something terribly obvious here? Does anyone have any suggestions/solutions/advice? Thank you all very much~ Quote Link to comment https://forums.phpfreaks.com/topic/85997-alternative-to-cookies-reliability-of-http_referer/ Share on other sites More sharing options...
revraz Posted January 14, 2008 Share Posted January 14, 2008 Why not use a session variable? Or do you want it to suppress even when they return later one? If so, you have to use a cookie. Quote Link to comment https://forums.phpfreaks.com/topic/85997-alternative-to-cookies-reliability-of-http_referer/#findComment-439146 Share on other sites More sharing options...
tinker Posted January 14, 2008 Share Posted January 14, 2008 not really a good solution but check the logs, only works per session though since it's the first page, if it wasn't you could do on user. But shouldn't a session var work? If already set then don't do... Quote Link to comment https://forums.phpfreaks.com/topic/85997-alternative-to-cookies-reliability-of-http_referer/#findComment-439159 Share on other sites More sharing options...
iwannabeleet Posted January 14, 2008 Author Share Posted January 14, 2008 not really a good solution but check the logs, only works per session though since it's the first page, if it wasn't you could do on user. But shouldn't a session var work? If already set then don't do... *smacks forehead* Yes I guess that is the 'global variable voodoo' I was talking about. Sorry, I am a noob. Thank you both for pointing me in the right direction. I think that will solve the problem. Quote Link to comment https://forums.phpfreaks.com/topic/85997-alternative-to-cookies-reliability-of-http_referer/#findComment-439166 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.