$s = new CGI::Session( "driver:file", undef, {Directory=>'/tmp/'} ) or die CGI::Session->errstr; # the user's data $s->param('username',$user); $s->param('userid',$userid); $s->param('name',$name); $s->param('surname',$surname); $s->param('~logged-in',"true"); $ipaddr = $s->param('_SESSION_REMOTE_ADDR'); $hostname = qx#host $ipaddr |awk {'print \$5'}#; # verify the user's access level if($isadmin eq 1) { $s->param('isadmin',"true"); } else { $s->param('isadmin',"false"); $s->param('access',"11"); } # register the last login my $lastlogin = funcs::DB->dbgetuniq("SELECT access FROM users_access WHERE userid=\"$userid\" ORDER BY access DESC","access"); $s->param('lastlogin',"$lastlogin"); $s->expire("~logged-in", "30m"); $s->expire('+6h'); # register the user access funcs::DB->dbdo("INSERT INTO users_access VALUES('','$userid','$ipaddr','$hostname',NOW())"); print $s->header(-location=>'http://mysite/');