in reply to Re: Session problem
in thread Session problem
This is what i understand from myself and tried to implement it on my project. If you find something is not good practice or this thing can be done in more efficient way . Kindly advice me on it also. Thanks .my $q=new CGI; my %KVP=$q->Vars; $id=KVP{'sessionid'}) //post hidden variable $session=&session_start($q,$id); $sessionid=$session->id; . . . if($session) { session_destroy($session); //This doesn’t empty the cgisess_ var in /tmp } sub session_start() { my($cgi,$session_id)=@_; if($session_id eq '') { #create new session $session = new CGI::Session(undef, $cgi, {Directory=>'/tmp/'}); } else { #reinitialse with session with session id $session= new CGI::Session(undef, $session_id, {Directory=>'/tmp'} +) } return $session; } sub session_destroy() { my($session)=@_; $session->delete(); }
|
|---|