Gossamer Forum
Home : General : Perl Programming :

session cookies and cgi scripts

Quote Reply
session cookies and cgi scripts
Hi folks,
Im perplexed about a situation that has arisen on a website I am working on.

It would appear that somehow my scripts are screwing up as far as setting temporary session cookies.

They always work in Internet Explorer 5.0+ but have some problems in netscapes browsers.

Inside of my login script I have the following code:

print "Set-Cookie: login=$Username;\n";
print "domain=.mydomain.com";
print "path=/cgi-bin/";

Where it says mydomain.com is actually not the domain name but changed here to protect the innocence of the site owners.

Is there something wrong with this bit of coding?

When I retrieve the cookies in all cgi scripts I do it with the following bit of coding:


############################################################
# MEMBER MUST LOGIN TO MODIFY OR CREATE PROFILE
############################################################
sub memberlogin{
$cookie="$ENV{'HTTP_COOKIE'}";
($trash,$member) = split(/login=/,$cookie);
if ($member =~ /;/){
($member,$trash) = split(/;/,$member);
}
if ($member eq ""){
print "Content-type: text/html\n\n";


&loginerror;
exit;
}
}


Is there anything wrong with this coding that you all can see, I certainly don't see it, but they have users that complain about the system forgetting who they are after like 15 minutes or so, and some users just can't get in at all, keeps looping them around to the loginerror page.

When they login, enter their username and password, they are directed to a ad page, with a link to the main menu, when they click on the main menu, they are told they are not logged in, of course in IE 5.01 it works flawlessly, but supposedly in earlier version of IE like 4.5, they are occasionally having this problem.

Can anyone spot what I've done wrong here.

Thanks for the help, very much appreciated.

Harrison


"I've got if's pretty good, but that's about it"