Why isnt my cookie getting saved.
-------------------------
#!/usr/bin/perl -w
####################
# WeBeWebin
# Browse Admin
# Andrew Rosolino
# V. 1.0
####################
##### Load Modules
use DBI;
use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser'; # <-- recommended
my $q = new CGI;
# Making connection to the database;
sub DBI {
$dsn = "DBI:mysql:homewebewebin:localhost";
$dbh = DBI->connect($dsn, webewebin,w3b3w3bin) or die
"$DBI::errstr";
$sth = $dbh->prepare("SELECT username,password FROM
browse_admin") or die "$DBI::errstr";
$sth->execute or die "$DBI::errstr";
($username,$password) = $sth->fetchrow_array;
}
unless ($q->param('Act')) {
&begin;
} else {
✓
}
#####Start Admin
sub begin {
if(defined $ENV{HTTP_COOKIE}) {
($a, $b) = split(/=/, $ENV{HTTP_COOKIE});
print "$ENV{HTTP_COOKIE}";
}
print header,
start_html('Login Admin'),
h1('Login:'),
start_form,
"$ENV{'HTTP_COOKIE'}",p,
"Username: ",textfield('username'),p,
"Password: ",password_field('password'),p,
hidden('Act','check'),p,
submit('Login'),
end_form;
}
#####Check Admin
sub check {
&DBI;
$sth = $dbh->prepare("SELECT username,password FROM
browse_admin") or die "$DBI::errstr";
$sth->execute or die "$DBI::errstr";
while(($username,$password) = $sth->fetchrow_array) {
if($username eq $q->param('username') && $password eq
$q->param('password')) { &bed; }
else { print header,
"Username Or Password Is
Incorrect"; }
}
$sth->finish;
$dbh->disconnect;
}
sub bed {
$cookie = $q->cookie(-name=>"$username",
-value=>"$password",
-expires=>'1d',
-path=>'/',
-domain=>'.webewebin.com',
-secure=>1);
print $q->header(-cookie=>$cookie),p,
"Cookie Planted ( I
Think.Hope )";
print "$ENV{'HTTP_COOKIE'}";
}
----------
Andrew
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]