defeating a flash intro page
| From: | Mark Peoples | Date: | Sun, 29 Oct 2000 08:16:32 +0000 |
| Subject: | defeating a flash intro page | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22531@lists.php.net to get a copy of this message | ||
Ok, we're putting up a new site for an existing site, but we've got an intro
page that has a quick flash movie in it. Within the site, on every page,
there is a link to the 'root' page (href="/"), which, in our case is
index.php3 (of course <g>).
The problem is that we don't want visitors to have to go through the flash
intro every time they come back to / . So, I got to thinking of how to make
this not happen. Well, it'd be easy with cookies, but not all surfers are
like Cookie Monster. =) Then, when looking through the online manual for
something else, I saw a reference to $HTTP_REFERER, and remembered using it
in the past for something else.
So, my simple solution was:
--index.php3--
<?php
if(!(eregi("yourdomain.com", $HTTP_REFERER)))
{
//display what you want on your flash page... virtual() would probably be
even better though
}
else
{
//display what you'd normally get when you click on 'Skip Intro' on your
flash page
}
?>
The reason I do the !(eregi() is to make it easier to add it to pages you've
already got. Like...
--index.php3--
<?php
if(!(eregi("yourdomain.com", $HTTP_REFERER)))
{
//display what you want on your flash page... virtual() would probably be
even better though
}
else
{
//display what you'd normally get when you click on 'Skip Intro' on your
flash page
?>
<i>here is some more html</i>
<p>You see this after you click on 'Skip Intro' or when you link from
another page somewhere on your site.</p>
<?php
}
?>
I'm sure someone else can come up with a better regular expression (eg, like
one to defeat a link from a search from yahoo)...something like (this is
totally wrong...it ain't PHP, it's *pseudocode*, I'm tired, and, it's 1AM
<g>):
eregi("http://????.yourdomain.com",
$HTTP_REFERER)
where ???? could be any valid sequence of characters of various lengths in a
URL so you could have links from sub-domain.yourdomain.com and
www.yourdomain.com that would work as intended.
Have fun with it, but test it before you use it in production. =)
marco