CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Check URL



May 22, 2000, 5:35 AM

Post #1 of 2 (987 views)
Check URL Can't Post

Hi there,

I'm creating a script that will generate a page on the fly, now, I want the page thats generated to reflect the page that the user came from.

Is it possible for someone to provide me with a script that checks the URL that a user came from?

Richard Benwell


May 22, 2000, 6:10 AM

Post #2 of 2 (987 views)
Re: Check URL [In reply to] Can't Post

You might get a reasonable value in the $ENV{HTTP_REFERER} variable. That holds the value of the referrer (yes, that is the correct way to spell the word -- the variable is spelled incorrectly), but it is subject to tampering. But if you don't really care, then you can do something like:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

use LWP::Simple;
$previous_page = get $ENV{HTTP_REFERER};

And then $previous_page holds the content of the page they supposedly linked from. Note that they MUST HAVE LINKED FROM THE PAGE to make it the HTTP_REFERER. That's because that's what it MEANS to refer.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives