检查当前Session ID是否合法
boolean Module_Session::check_session_id( string $sid )
参数列表
参数 类型 描述 默认值 $sid
string
$sid
boolean
public static function check_session_id($sid)
{
if (strlen($sid)!=32)return false;
if (!preg_match('/^[a-fA-F\d]{32}$/', $sid))return false;
$mt_str = substr($sid, 0, 28);
$check_str = substr($sid, -4);
if (substr(md5('doe9%32' . $mt_str . Session::$config['check_string']), 8, 4) === $check_str)
{
return true;
}
else
{
return false;
}
}