Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.40 KB | None | 0 0
  1.     public function logout(){
  2.  
  3.         global $USER;
  4.        
  5.         if (!is_object($USER))
  6.            
  7.             $USER = new CUser;
  8.  
  9.         if($_SERVER['HTTP_X_TOKEN']):
  10.  
  11.             Load::includeModule('main');
  12.  
  13.             $result = array();
  14.  
  15.             $userBy = "id";
  16.             $userOrder = "desc";
  17.  
  18.             $userFilter = array(
  19.                 "ACTIVE"    =>  "Y",
  20.                 "UF_API_TOKEN"     =>  $_SERVER['HTTP_X_TOKEN']
  21.             );
  22.  
  23.             $userParam = array(
  24.                 "FIELDS" => array(
  25.                     "ID",
  26.                     "LOGIN"
  27.                 )
  28.             );
  29.  
  30.             $rsUser = CUser::GetList(
  31.                 $userBy,
  32.                 $userOrder,
  33.                 $userFilter,
  34.                 $userParam
  35.             );
  36.  
  37.             if($arUser = $rsUser -> Fetch()) {
  38.                     $oUser = new CUser;
  39.                     $aFields = array(
  40.                         'UF_API_TOKEN'          => '',
  41.                         'UF_API_TOKEN_DATE'     => ''
  42.                     );
  43.                     $res = $oUser->Update($arUser['ID'], $aFields);
  44.  
  45.                     if ($res) {
  46.                         $result['success'] = true;
  47.                     }
  48.  
  49.                     else{
  50.                         $result['success'] = true;
  51.                     }
  52.  
  53.  
  54.             }
  55.  
  56.         endif;
  57.  
  58.         return $result;
  59.  
  60.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement