예제 #1
0
 protected function __construct()
 {
     if (!defined('LOG_ID')) {
         define('LOG_ID', Bd_Passport_Util::getLogId());
     }
     if (!defined('CLIENT_IP')) {
         define('CLIENT_IP', Bd_Passport_Util::getClientIp());
     }
 }
예제 #2
0
 /** 
  * @brief	[Util]校验bdstoken
  * @param	string	$token	传入的待检查的token
  * @param	string	$src	传入的md5串1,已登陆用户为bduss,未登陆用户为baiduid
  * @param	string	$key	传入的md5串2,设置的密钥串, 详细参考getBdsToken的说明
  * @param	string  $srcex	传入的md5串3,扩展使用,详细参考getBdsToken的说明
  * @return	a bool or string  检查通过:true;检查错误:错误说明
  * @author	lichao 
  * @date	Wed May 20 00:00:38 CST 2009 
  * @version 1.0.0  
  *			token,src,key,srcex参数类型必须为string; 
  *			srcex不作为计算md5参数时必须传入参数null;
  **/
 public static function checkBdsToken($token, $src, $key, $srcex)
 {
     return Bd_Passport_Util::checkBdsToken($token, $src, $key, $srcex);
 }
예제 #3
0
 protected function _packNshead($intBodyLen)
 {
     $intLogId = Bd_Passport_Util::getLogId();
     return pack('SSIa16III', 0, 1, $intLogId, 'pass-glib', 0xfb709394, 0, $intBodyLen);
 }
예제 #4
0
 protected function __construct()
 {
     self::$_appUser = Bd_Passport_Conf::getConf('app_user');
     self::$_appPasswd = Bd_Passport_Conf::getConf('app_passwd');
     self::$_encoding = Bd_Passport_Conf::getConfEx('internal_encoding', 'utf8');
     if (!in_array(self::$_encoding, array('gbk', 'gb18030', 'utf8'))) {
         self::$_encoding = 'utf8';
     }
     if (is_null(self::$_appUser) || is_null(self::$_appPasswd)) {
         Bd_Passport_Log::warning("Invalid app_user or app_passwd.", E_USER_ERROR);
     }
     if (!defined('LOG_ID')) {
         define('LOG_ID', Bd_Passport_Util::getLogId());
     }
     if (!defined('CLIENT_IP')) {
         define('CLIENT_IP', Bd_Passport_Util::getClientIp());
     }
 }
예제 #5
0
 /**
  * @brief	Talk With Session
  *
  */
 protected static function _____($strMethod, $arrInput)
 {
     $ins = Bd_Passport_Interact::getEngine('Ral');
     //Fix Clientip . NET-ORDER , Int32(Neither UInt32 nor Long)
     $arrInput['clientip'] = Bd_Passport_Util::ip2int(CLIENT_IP);
     //If @ORP , Need Pass(ie, Session Key)
     if (self::$_is_orp) {
         $arrInput['pass'] = self::$_pass;
     }
     //If the session server is busy , Just retry once.
     $retry = 1;
     while ($retry >= 0) {
         // Do Interaction CALL HERE !!!
         $ret = $ins->Call('session', $strMethod, $arrInput);
         if (is_array($ret) && isset($ret['status'])) {
             self::$_errno = $ret['status'];
             //if (self::$_errno != 0) {
             //	Bd_Passport_Log::warning(self::$errmsgMap[self::$_errno], self::$_errno);
             //}
             if (self::RET_SSN2_SERVER_BUSY === $ret['status']) {
                 Bd_Passport_Log::warning(self::$errmsgMap[self::$_errno], self::$_errno);
                 --$retry;
                 continue;
             } else {
                 return $ret;
             }
         } else {
             //Let errno not defined , getMessage will return 'Unknown error'.
             Bd_Passport_Log::warning('Unknown Error', self::$_errno);
             self::$_errno = -1;
             return false;
         }
     }
     return false;
 }