private static function _SGetCaller() { if (is_null(self::$s_sCaller)) { self::$s_sCaller = sprintf('%s:%s:%08x', Ko_Tool_Module::SGetScriptFullName(), Ko_Tool_Ip::SGetServerIp(), mt_rand()); KO_DEBUG >= 5 && Ko_Tool_Debug::VAddTmpLog('data/KProxy', '_SGetCaller_Create:' . self::$s_sCaller); } return self::$s_sCaller; }
private function _vInsertInfo(&$arr, $oDao, $sHintId, $vAdmin) { $arr[$this->_sIdField] = $sHintId; if (strlen($this->_sKindField)) { $arr[$this->_sKindField] = $oDao->sGetTableName(); } if (strlen($this->_sAdminField)) { $arr[$this->_sAdminField] = is_array($vAdmin) ? Ko_Tool_Enc::SEncode($vAdmin) : $vAdmin; } if (strlen($this->_sIpField)) { $arr[$this->_sIpField] = Ko_Tool_Ip::SGetClientIP(); } $this->_oObsDao->aInsert($arr); }
/** * 增加一条调试记录 */ public static function VAddTmpLog($sTag, $sLog) { if (KO_DEBUG) { if (!file_exists(KO_LOG_FILE)) { @touch(KO_LOG_FILE); @chmod(KO_LOG_FILE, 0666); } if (is_writable(KO_LOG_FILE)) { $sLog = sprintf("%s\t%s\t%d\t%s\t%s\n", date('Y-m-d H:i:s'), Ko_Tool_Ip::SGetClientIP(), getmypid(), $sTag, $sLog); $fp = fopen(KO_LOG_FILE, 'a'); fwrite($fp, $sLog); fclose($fp); $filesize = filesize(KO_LOG_FILE); if ($filesize >= 1024 * 1024 * 1024) { $newfilename = KO_LOG_FILE . '.' . date('YmdHis'); @rename(KO_LOG_FILE, $newfilename); } } } }
protected function _aGetLocation($sIp) { if (0 === strlen($sIp)) { $sIp = Ko_Tool_Ip::SGetClientIP(); } $loc = Ko_Data_IPLocator::OInstance()->sGetLocation($sIp); $loc = Ko_Tool_Str::AStr2Arr_GB18030($loc); return implode('', array_slice($loc, 0, 2)); }
private function _vInsertAction($iOid, $iCid, $iThread, $iAction, $vAdmin) { if (strlen($this->_aConf['action'])) { $actionDao = $this->_aConf['action'] . 'Dao'; $arr = array('oid' => $iOid, 'cid' => $iCid, 'thread_cid' => $iThread, 'action' => $iAction, 'admin' => is_array($vAdmin) ? Ko_Tool_Enc::SEncode($vAdmin) : $vAdmin, 'ip' => Ko_Tool_Ip::SGetClientIP(), 'ctime' => date('Y-m-d H:i:s')); $this->{$actionDao}->aInsert($arr); } }
private function _aGetInnerIpInfo() { $ret = Ko_Tool_CMD::AFindIpInfo(); foreach ($ret as $v) { if (Ko_Tool_Ip::BIsInnerIP($v['ip'])) { return $v; } } assert(0); }