|  | Posted by petersprc on 11/19/06 10:41 
Hi,
 It should let you navigate to the forum page... Maybe this works
 better:
 
 function checkReferrer()
 {
 if (isset($_SERVER['HTTP_REFERER']) && preg_match(
 '#^https?://' . preg_quote($_SERVER['HTTP_HOST'], '#') .
 '(/|$)#i', $_SERVER['HTTP_REFERER'])) {
 return true;
 }
 header('Location: /');
 return false;
 }
 
 Try var_dump($_SERVER['HTTP_REFERER']) when the link is clicked to
 troubleshoot it.
 
 Ulle wrote:
 > Hi All
 >
 > This one did some of the work
 >
 > <?
 >
 > // Replace my.site with your site
 >
 > function checkReferrer()
 > {
 >   if (isset($_SERVER['HTTP_REFERER']) && preg_match(
 >       '#^https?://my.site(/|$)#i', $_SERVER['HTTP_REFERER'])) {
 >     return true;
 >   }
 >   header('Location: /');
 > }
 >
 > checkReferrer();
 >
 > ?>
 >
 > But the point is its cool its gonna redirect you if you type the adress i
 > the browser... But if you click on the button "Forum" it should redirect you
 > to the forum, but its redirecting to the main page again, so im a little
 > stuck in a loop here... lol... It should redirect if you type direct in the
 > browser to the main page, but if you push the forum button on the main page
 > it should send you to the forum, but it dosnt,..
 >
 > Best Regards
 > Ulrik Martinsson
 > --
 > Best Regards
 > Ulrik Martinsson
 > Adminstrator at http://www.Sega-Star.com. Clan Admin at
 > http://www.pf-clan.com
 > "Christoph Burschka" <christoph.burschka@rwth-aachen.de> wrote in message
 > news:4s2l35Ftbjs7U1@mid.dfncis.de...
 > > Michael Fesser schrieb:
 > >> .oO(petersprc@gmail.com)
 > >>
 > >>
 > >>>You can do this by checking the referrer. For example:
 > >>>[...]
 > >>
 > >>
 > >> Then some people will never be able to use the site.
 > >
 > > Indeed. It is possible to suppress the sending of the referrer in the
 > > settings of most browsers to ensure better privacy. I don't bother, but I
 > > know some people who do this.
 > >
 > > As with Javascript and Internet Explorers "enhancements", it is good
 > > practice to ensure your site does not depend on a certain browser or a
 > > certain setting to be enabled.
 > >
 > > If you absolutely need to do this redirect, perhaps use a cookie as a
 > > fall-back method (or only a cookie, period).
 > >
 > > The difference is that unlike the referrer check, the browser will
 > > *notice* that  you are trying to transmit a cookie and will prompt the
 > > user if they don't accept cookies automatically. The referrer check will
 > > silently succeed or silently fail without the user having a clue what is
 > > wrong.
  Navigation: [Reply to this message] |