I'm building a database using mysql and perl. If a user provides correct login info, a cookie is set like this:
my $cookie = $q->cookie(-name =>"ggtUser", -value => $username);
print $q->redirect(-location=> "the url of the homepage here",
-cookie => $cookie);
Each pages in my database site checks the cookie and if it's not there, the user is redirected to the login page.
my $theCookie = $q->cookie('ggtUser');
if(not $theCookie) {
#code to redirect to login page here
}else{
#display the page
}
I want to set a logout button. when it's clicked, logout.cgi runs,
here is my logout.cgi:
#!/usr/bin/perl -w
use CGI qwstandard);
my $q=new CGI;
my $cookie = $q-cookie(-name ="ggtUser", -expires='-1h');
print $q-redirect(-location= "the url of the login page here",
-cookie = $cookie);
I set the time to a -1h, so the cookie will expire and even if
the user does not close the IE, he has to login again to enter the
database. but it does not work. after I click logout, if I paste the
URL of a page in my database into IE, it still opens. Does anyone know why my logout.cgi does not work?
Thanks for any help!
my $cookie = $q->cookie(-name =>"ggtUser", -value => $username);
print $q->redirect(-location=> "the url of the homepage here",
-cookie => $cookie);
Each pages in my database site checks the cookie and if it's not there, the user is redirected to the login page.
my $theCookie = $q->cookie('ggtUser');
if(not $theCookie) {
#code to redirect to login page here
}else{
#display the page
}
I want to set a logout button. when it's clicked, logout.cgi runs,
here is my logout.cgi:
#!/usr/bin/perl -w
use CGI qwstandard);
my $q=new CGI;
my $cookie = $q-cookie(-name ="ggtUser", -expires='-1h');
print $q-redirect(-location= "the url of the login page here",
-cookie = $cookie);
I set the time to a -1h, so the cookie will expire and even if
the user does not close the IE, he has to login again to enter the
database. but it does not work. after I click logout, if I paste the
URL of a page in my database into IE, it still opens. Does anyone know why my logout.cgi does not work?
Thanks for any help!