Changeset 15751


Ignore:
Timestamp:
2007/09/19 19:40:17 (17 years ago)
Author:
adachi
Message:

Notice修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-templates/data/class/SC_Session.php

    r15056 r15751  
    88/* ¥»¥Ã¥·¥ç¥ó´ÉÍý¥¯¥é¥¹ */ 
    99class SC_Session { 
    10     var $login_id;      // ¥í¥°¥¤¥ó¥æ¡¼¥¶Ì¾ 
    11     var $authority;     // ¥æ¡¼¥¶¸¢¸Â 
    12     var $cert;          // ǧ¾Úʸ»úÎó(ǧ¾ÚÀ®¸ù¤ÎȽÄê¤Ë»ÈÍÑ) 
    13     var $sid;           // ¥»¥Ã¥·¥ç¥óID 
    14     var $member_id;     // ¥í¥°¥¤¥ó¥æ¡¼¥¶¤Î¼ç¥­¡¼ 
     10    var $login_id;      // ¥í¥°¥¤¥ó¥æ¡¼¥¶Ì¾ 
     11    var $authority;     // ¥æ¡¼¥¶¸¢¸Â 
     12    var $cert;          // ǧ¾Úʸ»úÎó(ǧ¾ÚÀ®¸ù¤ÎȽÄê¤Ë»ÈÍÑ) 
     13    var $sid;           // ¥»¥Ã¥·¥ç¥óID 
     14    var $member_id;     // ¥í¥°¥¤¥ó¥æ¡¼¥¶¤Î¼ç¥­¡¼ 
    1515    var $uniqid;         // ¥Ú¡¼¥¸Á«°Ü¤ÎÀµÅöÀ­¥Á¥§¥Ã¥¯¤Ë»ÈÍÑ 
    16      
    17     /* ¥³¥ó¥¹¥È¥é¥¯¥¿ */ 
    18     function SC_Session() { 
    19         // ¥»¥Ã¥·¥ç¥ó³«»Ï 
    20         sfDomainSessionStart(); 
    2116 
    22         // ¥»¥Ã¥·¥ç¥ó¾ðÊó¤ÎÊݸ 
    23         if(isset($_SESSION['cert'])) { 
    24             $this->sid = session_id(); 
    25             $this->cert = $_SESSION['cert']; 
    26             $this->login_id  = $_SESSION['login_id']; 
    27             $this->authority = $_SESSION['authority'];  // ´ÉÍý¼Ô:0, °ìÈÌ:1, ±ÜÍ÷:2 
    28             $this->member_id = $_SESSION['member_id']; 
    29             $this->uniqid    = $_SESSION['uniq_id']; 
    30              
    31             // ¥í¥°¤Ëµ­Ï¿¤¹¤ë 
    32             gfPrintLog("access : user=".$this->login_id." auth=".$this->authority." sid=".$this->sid); 
    33         } else { 
    34             // ¥í¥°¤Ëµ­Ï¿¤¹¤ë 
    35             gfPrintLog("access error."); 
    36         } 
    37     } 
    38     /* ǧ¾ÚÀ®¸ù¤ÎȽÄê */ 
    39     function IsSuccess() { 
    40         global $arrPERMISSION; 
    41         if($this->cert == CERT_STRING) { 
    42             if(isset($arrPERMISSION[$_SERVER['PHP_SELF']])) { 
    43                 // ¿ôÃͤ¬¼«Ê¬¤Î¸¢¸Â°Ê¾å¤Î¤â¤Î¤Ç¤Ê¤¤¤È¥¢¥¯¥»¥¹¤Ç¤­¤Ê¤¤¡£ 
    44                 if($arrPERMISSION[$_SERVER['PHP_SELF']] < $this->authority) {            
    45                     return AUTH_ERROR; 
    46                 }  
    47             } 
    48             return SUCCESS; 
    49         } 
    50          
    51         return ACCESS_ERROR; 
    52     } 
    53      
    54     /* ¥»¥Ã¥·¥ç¥ó¤Î½ñ¤­¹þ¤ß */ 
    55     function SetSession($key, $val) { 
    56         $_SESSION[$key] = $val; 
    57     } 
    58      
    59     /* ¥»¥Ã¥·¥ç¥ó¤ÎÆɤ߹þ¤ß */ 
    60     function GetSession($key) { 
    61         return $_SESSION[$key]; 
    62     } 
    63      
    64     /* ¥»¥Ã¥·¥ç¥óID¤Î¼èÆÀ */ 
    65     function GetSID() { 
    66         return $this->sid; 
    67     } 
    68      
    69     /** ¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ **/  
     17    /* ¥³¥ó¥¹¥È¥é¥¯¥¿ */ 
     18    function SC_Session() { 
     19        // ¥»¥Ã¥·¥ç¥ó³«»Ï 
     20        sfDomainSessionStart(); 
     21 
     22        // ¥»¥Ã¥·¥ç¥ó¾ðÊó¤ÎÊݸ 
     23        if(isset($_SESSION['cert'])) { 
     24            $this->sid = session_id(); 
     25            $this->cert = $_SESSION['cert']; 
     26            $this->login_id  = $_SESSION['login_id']; 
     27            $this->authority = $_SESSION['authority'];  // ´ÉÍý¼Ô:0, °ìÈÌ:1, ±ÜÍ÷:2 
     28            $this->member_id = $_SESSION['member_id']; 
     29            $this->uniqid    = isset($_SESSION['uniq_id']) ? $_SESSION['uniq_id'] : ''; 
     30 
     31            // ¥í¥°¤Ëµ­Ï¿¤¹¤ë 
     32            gfPrintLog("access : user=".$this->login_id." auth=".$this->authority." sid=".$this->sid); 
     33        } else { 
     34            // ¥í¥°¤Ëµ­Ï¿¤¹¤ë 
     35            gfPrintLog("access error."); 
     36        } 
     37    } 
     38    /* ǧ¾ÚÀ®¸ù¤ÎȽÄê */ 
     39    function IsSuccess() { 
     40        global $arrPERMISSION; 
     41        if($this->cert == CERT_STRING) { 
     42            if(isset($arrPERMISSION[$_SERVER['PHP_SELF']])) { 
     43                // ¿ôÃͤ¬¼«Ê¬¤Î¸¢¸Â°Ê¾å¤Î¤â¤Î¤Ç¤Ê¤¤¤È¥¢¥¯¥»¥¹¤Ç¤­¤Ê¤¤¡£ 
     44                if($arrPERMISSION[$_SERVER['PHP_SELF']] < $this->authority) { 
     45                    return AUTH_ERROR; 
     46                } 
     47            } 
     48            return SUCCESS; 
     49        } 
     50 
     51        return ACCESS_ERROR; 
     52    } 
     53 
     54    /* ¥»¥Ã¥·¥ç¥ó¤Î½ñ¤­¹þ¤ß */ 
     55    function SetSession($key, $val) { 
     56        $_SESSION[$key] = $val; 
     57    } 
     58 
     59    /* ¥»¥Ã¥·¥ç¥ó¤ÎÆɤ߹þ¤ß */ 
     60    function GetSession($key) { 
     61        return $_SESSION[$key]; 
     62    } 
     63 
     64    /* ¥»¥Ã¥·¥ç¥óID¤Î¼èÆÀ */ 
     65    function GetSID() { 
     66        return $this->sid; 
     67    } 
     68 
     69    /** ¥æ¥Ë¡¼¥¯ID¤Î¼èÆÀ **/ 
    7070    function getUniqId() { 
    7171        // ¥æ¥Ë¡¼¥¯ID¤¬¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¥»¥Ã¥È¤¹¤ë¡£ 
     
    7575        return $this->GetSession('uniqid'); 
    7676    } 
    77      
    78     /** ¥æ¥Ë¡¼¥¯ID¤Î¥»¥Ã¥È **/  
     77 
     78    /** ¥æ¥Ë¡¼¥¯ID¤Î¥»¥Ã¥È **/ 
    7979    function setUniqId() { 
    8080        // ͽ¬¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¥é¥ó¥À¥àʸ»úÎó¤òÉÕÍ¿¤¹¤ë¡£ 
    8181        $this->SetSession('uniqid', sfGetUniqRandomId()); 
    8282    } 
    83      
    84     /* ¥»¥Ã¥·¥ç¥ó¤ÎÇË´þ */ 
    85     function EndSession() { 
    86         // ¥Ç¥Õ¥©¥ë¥È¤Ï¡¢¡ÖPHPSESSID¡× 
    87         $sname = session_name(); 
    88         // ¥»¥Ã¥·¥ç¥óÊÑ¿ô¤òÁ´¤Æ²ò½ü¤¹¤ë 
    89         $_SESSION = array(); 
    90         // ¥»¥Ã¥·¥ç¥ó¤òÀÚÃǤ¹¤ë¤Ë¤Ï¥»¥Ã¥·¥ç¥ó¥¯¥Ã¥­¡¼¤âºï½ü¤¹¤ë¡£ 
    91         // Note: ¥»¥Ã¥·¥ç¥ó¾ðÊó¤À¤±¤Ç¤Ê¤¯¥»¥Ã¥·¥ç¥ó¤òÇ˲õ¤¹¤ë¡£ 
    92         if (isset($_COOKIE[$sname])) { 
    93             setcookie($sname, '', time()-42000, '/'); 
    94         } 
    95         // ºÇ½ªÅª¤Ë¡¢¥»¥Ã¥·¥ç¥ó¤òÇ˲õ¤¹¤ë 
    96         session_destroy(); 
    97         // ¥í¥°¤Ëµ­Ï¿¤¹¤ë 
    98         gfPrintLog("logout : user=".$this->login_id." auth=".$this->authority." sid=".$this->sid); 
    99     } 
    100      
    101     // ´ØÏ¢¥»¥Ã¥·¥ç¥ó¤Î¤ßÇË´þ¤¹¤ë¡£ 
    102     function logout() { 
    103         unset($_SESSION['cert']); 
    104         unset($_SESSION['login_id']); 
    105         unset($_SESSION['authority']); 
    106         unset($_SESSION['member_id']); 
     83 
     84    /* ¥»¥Ã¥·¥ç¥ó¤ÎÇË´þ */ 
     85    function EndSession() { 
     86        // ¥Ç¥Õ¥©¥ë¥È¤Ï¡¢¡ÖPHPSESSID¡× 
     87        $sname = session_name(); 
     88        // ¥»¥Ã¥·¥ç¥óÊÑ¿ô¤òÁ´¤Æ²ò½ü¤¹¤ë 
     89        $_SESSION = array(); 
     90        // ¥»¥Ã¥·¥ç¥ó¤òÀÚÃǤ¹¤ë¤Ë¤Ï¥»¥Ã¥·¥ç¥ó¥¯¥Ã¥­¡¼¤âºï½ü¤¹¤ë¡£ 
     91        // Note: ¥»¥Ã¥·¥ç¥ó¾ðÊó¤À¤±¤Ç¤Ê¤¯¥»¥Ã¥·¥ç¥ó¤òÇ˲õ¤¹¤ë¡£ 
     92        if (isset($_COOKIE[$sname])) { 
     93            setcookie($sname, '', time()-42000, '/'); 
     94        } 
     95        // ºÇ½ªÅª¤Ë¡¢¥»¥Ã¥·¥ç¥ó¤òÇ˲õ¤¹¤ë 
     96        session_destroy(); 
     97        // ¥í¥°¤Ëµ­Ï¿¤¹¤ë 
     98        gfPrintLog("logout : user=".$this->login_id." auth=".$this->authority." sid=".$this->sid); 
     99    } 
     100 
     101    // ´ØÏ¢¥»¥Ã¥·¥ç¥ó¤Î¤ßÇË´þ¤¹¤ë¡£ 
     102    function logout() { 
     103        unset($_SESSION['cert']); 
     104        unset($_SESSION['login_id']); 
     105        unset($_SESSION['authority']); 
     106        unset($_SESSION['member_id']); 
    107107        unset($_SESSION['uniqid']); 
    108         // ¥í¥°¤Ëµ­Ï¿¤¹¤ë 
    109         gfPrintLog("logout : user=".$this->login_id." auth=".$this->authority." sid=".$this->sid); 
    110     } 
     108        // ¥í¥°¤Ëµ­Ï¿¤¹¤ë 
     109        gfPrintLog("logout : user=".$this->login_id." auth=".$this->authority." sid=".$this->sid); 
     110    } 
    111111} 
    112112?> 
Note: See TracChangeset for help on using the changeset viewer.