Set-Cookie: sessionID Date: Mon, 04 Aug 2003 02:50:03 GMT Content-Type: text/html; charset=ISO-8859-1 #### my %options; my $cookie; if (cookie('sessionID') && checkSessionID(cookie('sessionID'))) { $cookie = cookie(-name => 'sessionID', -value => cookie('sessionID'), -expires => '+1h', -path => '/'); } # you may notice I don't use -secure=>1...this is because # you require an ssl certificate to be present for the # cookie to work (although not all browsers really follow it) elsif (param('username') && param('password') && checkUserPass(param('username'),param('password))) { $cookie = cookie(-name => 'sessionID', -value => makeCookie(param('username'),param('password)), -expires => '+1h', -path => '/'); } $options{"-cookie"} = $cookie if $cookie; print header(%options),start_html; # now if $cookie is set, print stuff as if they're logged in