I am currently working on a cgi-script, which takes a
username and password, checks to see if it is right,
encripts it (not in this because I'm unsure of what
encription I can use), and send the encripted username +
sessionid to a cookie
I've checked everything, and only the cookie isn't
working. Before someone asks I check for the cookie using 4
methods: in IE and Mozilla turned on prompting and wasn't,
in IE searched entire computer for *.txt, in Mozilla
looked at cookie organizer, and sent cookie to screen, it showed up just fine. So any ideas on why the cookie dosen't work, and other input on general coding, would be
appricated.
#!/usr/bin/perl -wT
use strict;
use CGI;
use CGI::Cookie;
my $query = new CGI;
my $good_user = "";
my $good_pass = "";
my $real_user = "";
my $real_pass = "";
my $itis = "";
use vars qw($incuser $incpass);
&url if $query ->request_method() eq "GET";
my $pword_file = "/location/of/file/.password";
#will use database later but for now keep file
my $userid_entd = $query->param('incuser');
my $pword_entd = $query->param('incpass');
$userid_entd =~ tr/A-Z/a-z/;
$pword_entd =~tr/A-Z/a-z/;
&url if $userid_entd =~ /[^0-9a-z]/;
&url if $userid_entd eq "";
$good_user = $userid_entd;
&url if $pword_entd =~ /[^0-9a-z]/;
&url if $pword_entd eq "";
$good_pass = $pword_entd;
open (USERFILE, $pword_file) || die "File cannot open";
while (<USERFILE>)
{
chomp;
($real_user, $real_pass) = split /\|/;
if ($real_user eq $good_user && $real_pass eq $good_pass)
{
my $stime = time;
my $c = $query->cookie(
-name => 'ID',
-value => "${stime}${good_user}99",
-expires => '+1h',
-domain => '.domain.com',
-path => '/some/path',
);
print $query->header( -cookie => $c);
# print "Set-Cookie: $c\n"; #this was tried, also didn't work
$itis="good";
&url;
}
}
close (USERFILE);
&url;
#&url prints a header and checks to see if $itis eq "good"
#print one message if it is another if it isn't
"Pain is weakness leaving the body, I find myself in pain everyday" -me