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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
$ENV{'HTTP_REFERER'}

 



chinopaul
Novice

Jan 28, 2005, 7:44 AM

Post #1 of 5 (864 views)
$ENV{'HTTP_REFERER'} Can't Post

my $refpage = $ENV{'HTTP_REFERER'} ||"http://www.domain.com/") ;

What I am hoping for is. If it has a HTTP_REFERER great, if not set it to http://www.domain.com/

Didn't get an error but didn't set http://www.domain.com/ as $refpage.

Thanks for the help.


fish_who
New User

Jan 28, 2005, 11:56 AM

Post #2 of 5 (860 views)
Re: [chinopaul] $ENV{'HTTP_REFERER'} [In reply to] Can't Post

I would do something like:

my $refpage = $ENV{'HTTP_REFERER'};

if (!$refpage) {
$refpage = "http://www.domain.com";
}


KevinR
Veteran


Jan 28, 2005, 2:51 PM

Post #3 of 5 (858 views)
Re: [chinopaul] $ENV{'HTTP_REFERER'} [In reply to] Can't Post

this should work:

my $refpage = $ENV{'HTTP_REFERER'} || "http://www.domain.com/";


if it's not it could be a problem somewhere else in the script.
-------------------------------------------------


davorg
Thaumaturge / Moderator

Feb 2, 2005, 2:03 AM

Post #4 of 5 (802 views)
Re: [chinopaul] $ENV{'HTTP_REFERER'} [In reply to] Can't Post

You seem to have an excess closing parenthesis on that line of code. Is that the problem?

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


chinopaul
Novice

Feb 2, 2005, 7:20 AM

Post #5 of 5 (796 views)
Re: [davorg] $ENV{'HTTP_REFERER'} [In reply to] Can't Post


In Reply To
You seem to have an excess closing parenthesis on that line of code. Is that the problem?



Yes that was the problem. Originally I had something like this my ($refpage = $ENV{'HTTP_REFERER'} ||"http://www.domain.com/") ; when that didnít work I removed that first parentheses but missed the one at the end. The code KevinR gave me my $refpage = $ENV{'HTTP_REFERER'} ||"http://www.domain.com/" ; works fine.

Thanks for the help.


 
 


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

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