On Mon, 2002-02-04 at 13:52, Philip Hallstrom wrote:
> Something along the lines of:
> 
> if( ereg("/confirm.php", $_SERVER['HTTP_REFERER']) )  {
>       Header("Location: thanks.php");
>       exit;
> }else {
>       Header("Location: index.php");
>       exit;
> }
> 
> You might want to do some additional checking as well.. the above would
> match both "/path/to/confirm.php" as well as
> "/path/to/somewhere/else.php?fakeit=/confirm.php")
> 
> I'll leave that sort of stuff up to you :)

One other note: you cannot trust the user agent to even send referrer 
header. They aren't required to, and it's quite easy to spoof (tools
such as wget and curl even include commands specifically so they can
lie about where they came from).

In short, you can never really know. You could, I suppose, make users
log in and track them with a session. Otherwise, while you *can* do
something like what you propose, it'll never be particularly robust
when using $HTTP_REFERER.


Torben

> On Wed, 30 Jan 2002, jas wrote:
> 
> > Ok I think I know what I need to learn... how can I do a redirect based on
> > whether or not a user came from a certain page?  For example... if a user
> > comes from a page called confirm.php then it takes them to a page called
> > thanks.php and if the user came from a different server or typed the url
> > directly then it would redirect the user to the index.php page?
> > Thanks in advance...
> > Jas
> > P.S. A tutorial on this would definately prevent me from posting the same
> > question again. =)
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to