Esempio n. 1
0
 /**
  * 获得当前用户的ID
  *
  * 先通过session获得uid
  * 若取不到再通过cookie获得uid
  */
 public static function get_client_uid()
 {
     if (isset($_SESSION['account_info'])) {
         return $_SESSION['account_info']->uid;
     } else {
         if (isset($_COOKIE[G_COOKIE_PREFIX . "_user_login"])) {
             $sso = TMS_CLIENT::decode_hash($_COOKIE[G_COOKIE_PREFIX . "_user_login"]);
             if ($sso['uid'] && $_SERVER['HTTP_USER_AGENT'] == $sso['UA']) {
                 return $sso['uid'];
             }
         }
     }
     return false;
 }