Dear monks
i am trying to set cookies, which seem to be working ok since the code doesnt throw any errors or warnings. I've my web browser set to prompt for cookies, so if they'd worked i should be prompted. it seems to just ignore it! here is the code that should first check for cookies and then set if none:
sub login {
if (exists $row[0], $password eq $row[1]) {
$cookie = $q->cookie(-name=>"username" ) || set_cookie($q);
$cookie1 = $q->cookie(-name=>"userpass" ) || set_cookie_pass($q);
print $q->header(-type=>"text/html"),
$q->start_html(-title=>" | Admin | ", -style=>{-src=>"../.
+./mycss.css"}),
$q->end_html;
} else {
error_page();
exit;
}
}
#################################################
sub set_cookie {
my $q = shift;
my $username_sub= $q->param('username');
$cookie = $q->cookie( -name=>"username",
-value=>$username_sub,
-expires=>"+30m");
}
sub set_cookie_pass {
my $q = shift;
my $password_sub = $q->param('password');
$cookie1 = $q->cookie(-name=>"password",
-value=>$password_sub,
-expires=>"+30m");
}
any ideas appreciated.cheers
r_mehmed
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.