Forum Moderators: coopster & phranque

Message Too Old, No Replies

Changing %ENV values, PERL

possible session cookie replacement

         

mdharrold

10:45 pm on Jul 31, 2002 (gmt 0)

10+ Year Member



Is it possible to change the enviornment variables in PERL and make them stick?

I made a quick test script:

#!/usr/local/bin/perl

print "Content-type: text/html\n\n";

if ($ENV{QUERY_STRING} eq "showthem")
{print "User - $ENV{REMOTE_USER}
<br />IP - $ENV{REMOTE_ADDR}";}

else
{$ENV{REMOTE_USER} = "My Name";
$ENV{REMOTE_ADDR} = "Text";
print "<a href=\"test.cgi?showthem\">Click Here</a>";}

exit(0);

but it didn't work. I'm trying to find an easy replacement for session cookies.

amoore

11:03 pm on Jul 31, 2002 (gmt 0)

10+ Year Member



No, they won't stay set from page to page like that. There are a few easy ways around that. You can put that info in a cookie for the person, or in hidden fileds of any form or in query strings of links.

hope it helps.

-Andy