Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Accessing a page first before getting into the site.

Custom Title Activated
Member
Joined
Dec 31, 2004
Messages
4,091
Reaction score
25
Hi Guys,

What I want to do is have when someone first goes to my site, they hit a disclaimer page, they scroll down, click I accept or I don't, but if they click yes, it carries on to the next page.

I want to do this to the first page they access, I know this is possible, I can remember doing something similar to this a while ago but instead it happened on every page, this would get annoying so I just want it on the first page they access.

My first guess was to use cookies, then if they didn't have the cookie saved it would show.

Second Guess was to use .htaccess .

My third guess was to just do it on every page using AJAX or something..

Anyone tips or tricks would be great,

Cheers.
Josh
 
Custom Title Activated
Member
Joined
Aug 8, 2004
Messages
3,892
Reaction score
20
First guess will do. Simply use

PHP:
if(!isset($_COOKIE['splash'])) {
  setcookie('splash', true, time() + (3600 * 24 * 30));
  header("Location: /splash.html");
}

on top of every page you use. Makes people not see a splash image for 30 days after they've seen it once. Make sure splash.html is available ofcourse :smile:

Alternatively you can do:

PHP:
    /****
      On top of all your PHP pages, before any output.
    ****/
if(!isset($_COOKIE['splash']))
  header("Location: /splash.php");

And put the cookie on your splash page (kind'a makes more sense that way):
PHP:
    /****
      splash.php - show a splash screen.
    ****/
setcookie('splash', true, time() + (3600 * 24 * 30));
 
Custom Title Activated
Member
Joined
Dec 31, 2004
Messages
4,091
Reaction score
25
Ohh, neat cheers :).
 
Divine Celestial
Member
Joined
Jul 7, 2004
Messages
853
Reaction score
5
Cookies are unnecessary.

Use a referrer check -- if the referrer is not from your domain, redirect to the desired page. Now, if they click accept, their referrer should indicate that they came from your own site, and you can display the page as necessary.

(I block cookies except for sites that absolutely *require* them, but this method still works because it doesn't use cookies.)
 
Custom Title Activated
Member
Joined
Aug 8, 2004
Messages
3,892
Reaction score
20
Wouldn't work, that way his visitors get the splash screen every time they go to his page, instead of only once as is what he wants:

when someone first goes to my site

Blocking cookies is ridiculous, even sessions are a form of cookies, that way you can't stay logged in ANYWHERE. Besides, cookies are totally harmless.
 
Divine Celestial
Member
Joined
Jul 7, 2004
Messages
853
Reaction score
5
I can remember doing something similar to this a while ago but instead it happened on every page, this would get annoying so I just want it on the first page they access.
I thought he meant that he wants the disclaimer page on every first visit to the site, but clicking around links within the site wouldn't redirect to the disclaimer page.
I just want it on the first page they access.
Nothing about remembering after 'leaving' the site... which is what cookies would do.
Blocking cookies is ridiculous, even sessions are a form of cookies, that way you can't stay logged in ANYWHERE. Besides, cookies are totally harmless.
I allow only session cookies (deleted after closing the browser), but otherwise it's pointless to store them, just look at how many cookies accumulate after a month of browsing. Likewise, for sites that absolutely require them (e.g. RaGEZONE), I do allow a cookie to be stored.
 
Custom Title Activated
Member
Joined
Feb 27, 2004
Messages
1,378
Reaction score
50
best one to use is a htaccess referrer check.

no code modifications needed.

psuedo code would look like

if referer is not ursite
show welcomepage

-- i would make u one. but everyone knows im lazy
 
Back
Top