Page 1 of 1

{RESOLVED} Force Start Page

Posted: Wed Aug 08, 2007 2:44 pm
by tmaiden
I want to force users to goto my main page (http://www.mysite.com/index.php)

If the user is outside of my page, ex: google.com

I don't want them to be able to type http://www.mysite.com/index.php?q=1 and goto q=1
instead if they type http://www.mysite.com/index.php?q=1 i want them to be redirected to http://www.mysite.com

once they have visted the main page, http://www.mysite.com, then they can follow links to index.php?q=1

Any suggestions or code snippets would greatly be appriciated.

Thanks.

Posted: Wed Aug 08, 2007 3:27 pm
by tmaiden

Code: Select all

$domains="www.mysite.com,mysite.com"; 

$domains=explode(",",$domains);   

if($_GET['q']!="")   { 
  
     $referer=explode("/",($_SERVER['HTTP_REFERER']));

     if(!in_array($referer[2],$domains))     {

          header("Location: http://".$domains[0]."/");     

          exit();     

     }  
 
}

Posted: Wed Aug 08, 2007 4:35 pm
by superdezign
That's a very bad idea since the HTTP_REFERER may not always exist.