Hi,
I am having a plain html page
(session.html) with UserName and password and SUBMIT button.
After pressing SUBMIT button, it will open a page
(query.cgi). On this page I am creating a session and writing the
cookie.
2 Separate problems :
-----------
1. Cookies are not being written in Cookies folder.
2. If I press refresh button on browser for "query.cgi" it creates a new session. I want the same session after refresh
button is pressed. Please helpme to achieve this. ( I dont want to use cookie)
###############- START Code for (session.html) -################
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<TITLE> Modify User </TITLE>
</HEAD> <BODY>
<form name="modifyuser" action="query.cgi" method="get" >
<BR> User id : <input type="text" name="lg_name" size=30>
Password<input type="text" name="lg_password" size=30>
<input type="submit" value="SUBMIT" >
</form>
</BODY>
</HTML>
###############- END Code for (session.html) -################
###############- START Code for (query.cgi) -################
<BR>
#!/perl/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use strict; use DBI;
use vivek::session;
use CGI::Session;
use CGI;
my $cgi = new CGI;
print $cgi->header;
print $cgi->start_html("query.cgi");
my $sid; my $session;
my $f_name; my $lg_psswd ;
my $lg_name = $cgi->param("lg_name");
print "<BR> lg_name --- $lg_name <BR>";
$session = new CGI::Session(undef, $cgi, {Directory=>'/tmp'});
my $cookie = $cgi->cookie(CGISESSID => $session->id );
print "cookies is : $cookie <BR>" ;
print $cgi->header(-cookie=>$cookie);
$sid = $session->id();
print "<BR>sid = $sid <BR>";
print $cgi->end_html;
###############- END Code for ((query.cgi) -##################
OUT PUT FROM QUERY.CGI : http://localhost/~administrator/Session_managemnt/sm_15apr/query.cgi?lg_name=asas&lg_password=asasa
######################################################
lg_name --- asas
cookies is : CGISESSID=f459ae140d01a8ed184d33c689816399; path=/
Set-Cookie: CGISESSID=f459ae140d01a8ed184d33c689816399; path=/ Date: T
+hu, 24 Apr 2008 09:13:42 GMT Content-Type: text/html;
charset=ISO-8859-1
sid = f459ae140d01a8ed184d33c689816399
######################################################
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.