rjsaulakh has asked for the wisdom of the Perl Monks concerning the following question:

i am new to cgi programming. what i am trying to do is build a user login page and then also implement session variables . so i need help with following 1. what is the best way to maintain session varaibles 2. do i maintain the session id on client or on my database machine 3. how can use cgi-perl to maintain session variables

Replies are listed 'Best First'.
Re: cgi programming
by davido (Cardinal) on May 26, 2005 at 07:12 UTC

    You should, of course, be using CGI for your basic CGI needs, and for session management, CGI::Session. No need to roll your own. Enjoy the read!

    Update:
    Now I see that you already got this answer in your earlier thread: session variables. Be sure to read the documentation for CGI::Session.


    Dave

      use CGI::sesssion::File; use CGI; my $cgi = new CGI; my $sid = $cgi->cookie(SESSION_COOKIE) || $cgi->param("sid") || undef; //creating a new session my $session = new CGI::Session::File(undef {LockDirectory=>"//enter the path of database server", Directory=>"//enter the path of database server"}) or die $CGI::Sessio +n::errstr; print "Your session id is ", $session->id(); // A cookie is being created which is then being send to the user brow +ser $cookie = $cgi->cookie(CGISESSID => $session->id ); print $cgi->header(-cookie=>$cookie); $session->save_param($cgi, ["login_name", "password"]);

      this is the script i have designed reading the doc what
      i want to do is when ever a userlogs on through the html page
      i use my cgi script to get userdetails like logging time , logout time, username , password and store it in a database
      please help me

Re: cgi programming
by bugsbunny (Scribe) on May 26, 2005 at 09:02 UTC
    U could also try Apache::ASP (www.apache-asp.org), and probably Apache::Session