Help for this page

Select Code to Download


  1. or download this
       # Create a random session ID number:
       my $sessionid = join "", map { int rand 100 } 1..20;
    ...
       print "Content-type: text/html\nSet-Cookie: session=$sessionid\n\n"
    +;
       # And remember on the server which session that is:
       storesessioninfo($sessionid, $username, %other_session_info);
    
  2. or download this
       if ($ENV{HTTP_COOKIE} =~ /sessionid=(\w+)/) {
          # Call the routine that reads the server-side session info:
          ($username, %other_session_info) = getsessioninfo($1); 
       }