Background:
In our utility program, we have just normal perl pages. There are two type of users, Admin and User. If they are trying to login, I need to save the value in session object and redirect to another page.
1. I tried to use just cookies, without using sessions, Here the problem is I can able to set the value first time. But I can't able to delete that(when user logouts, I am keeping empty string there)..my system is behaving something strange. This is simple example, but misbehaving. If I refresh the web page again, then the new value is appearing.
2. By using session, setting value is no problem, but the redirecting, just printing the url on web page.
my $session = session_header;#---by using CGI::Session;
if ( $query->param("frmsubmit") ) {
$uname = $query->param("uname");
$pwd = $query->param("pwd");
if ($uname eq "AA" && $pwd eq "AA") {
$session->param( "usertype", 'admin' ); # store into the session:
my $c = new CGI::Cookie(-name => 'plcuser',-value => 'admin', -expires
+ => '+20m');
print "Set-Cookie: $c\n";
print "Location: $rdurl\n\n";
#print $query->redirect($rdurl);
}
Thanks for help
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.