[Affelio-cvs 1058] CVS update: affelio/lib/Affelio/Managing

Back to archive index

Tadashi Okoshi slash****@users*****
2006年 1月 28日 (土) 17:47:22 JST


Index: affelio/lib/Affelio/Managing/SessionManager.pm
diff -u affelio/lib/Affelio/Managing/SessionManager.pm:1.3 affelio/lib/Affelio/Managing/SessionManager.pm:1.4
--- affelio/lib/Affelio/Managing/SessionManager.pm:1.3	Mon Dec 19 12:10:29 2005
+++ affelio/lib/Affelio/Managing/SessionManager.pm	Sat Jan 28 17:47:21 2006
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: SessionManager.pm,v 1.3 2005/12/19 03:10:29 slash5234 Exp $
+# $Id: SessionManager.pm,v 1.4 2006/01/28 08:47:21 slash5234 Exp $
 
 package Affelio::Managing::SessionManager;
 {
@@ -38,15 +38,27 @@
 
 	debug_print("SessionManager::new: start.");
         my $cgi = $af->{cgi};
-        my $sid = $cgi->cookie("affelio-$af->{user__nickname}");
-
+        my $given_sid = $cgi->cookie("affelio-$af->{user__nickname}");
+	debug_print("SessionManager::new: sid from cookie: [" . $given_sid . "]");
         my $session="";
-        if($sid){
+        if($given_sid){
             $session = new CGI::Session(undef,
-                                        $sid,
+                                        $given_sid,
 					{Directory=> $af->{site__session_dir}});
-            debug_print("SessionManager::new: Existing session: [" . $session->id . "]");
+            debug_print("SessionManager::new: sid after load: [" . $session->id . "]");
         }
+	debug_print("SessionManager::new:   $session");
+
+	if($session){
+	    if( $given_sid ne $session->id ){
+		debug_print("SessionManager::new:   SID in user's cookie already expired.");
+		debug_print("SessionManager::new:   session deleted.");
+		$session->delete();
+		$session->flush();
+		undef($session);
+	    }
+	}
+
 	my $self = {af => $af,
 		    ss => $session
 		    };
@@ -105,8 +117,6 @@
 	$self->{ss}->param("user_afid", $param{user_afid});
 	$self->{ss}->param("user_nickname", $param{user_nickname});
 	$self->{ss}->param("type", $param{type});
-	#current time
-	#expire time
     }
 
     ######################################################################


Affelio-cvs メーリングリストの案内
Back to archive index