includes/sessions.php
changeset 1071 f374801eb775
parent 1069 d54e7620bd3e
child 1079 fcc42560afe6
equal deleted inserted replaced
1070:617366710de2 1071:f374801eb775
  1395   function logout($level = USER_LEVEL_MEMBER)
  1395   function logout($level = USER_LEVEL_MEMBER)
  1396   {
  1396   {
  1397     global $db, $session, $paths, $template, $plugins; // Common objects
  1397     global $db, $session, $paths, $template, $plugins; // Common objects
  1398     $ou = $this->username;
  1398     $ou = $this->username;
  1399     $oid = $this->user_id;
  1399     $oid = $this->user_id;
  1400     if($level > USER_LEVEL_CHPREF)
  1400     if($level > USER_LEVEL_MEMBER)
  1401     {
  1401     {
  1402       $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
  1402       $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
  1403       if(!$this->user_logged_in || $this->auth_level < ( USER_LEVEL_MEMBER + 1))
  1403       if(!$this->user_logged_in || $this->auth_level < ( USER_LEVEL_MEMBER + 1))
  1404       {
  1404       {
  1405         return 'success';
  1405         return 'success';
  1414     {
  1414     {
  1415       if($this->user_logged_in)
  1415       if($this->user_logged_in)
  1416       {
  1416       {
  1417         $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
  1417         $aes = AESCrypt::singleton(AES_BITS, AES_BLOCKSIZE);
  1418         // Completely destroy our session
  1418         // Completely destroy our session
  1419         if($this->auth_level > USER_LEVEL_CHPREF)
  1419         if($this->auth_level > USER_LEVEL_MEMBER)
  1420         {
  1420         {
  1421           $this->logout(USER_LEVEL_ADMIN);
  1421           $this->logout(USER_LEVEL_ADMIN);
  1422         }
  1422         }
  1423         $this->sql('DELETE FROM '.table_prefix.'session_keys WHERE session_key=\''.md5($this->sid).'\';');
  1423         $this->sql('DELETE FROM '.table_prefix.'session_keys WHERE session_key=\''.md5($this->sid).'\';');
  1424         setcookie( 'sid', '', time()-(3600*24), scriptPath.'/' );
  1424         setcookie( 'sid', '', time()-(3600*24), scriptPath.'/' );