예제 #1
0
function adminLogin()
{
    global $cookie_key_admin;
    if (isset($_COOKIE['userId'], $_COOKIE['userName'], $_COOKIE['adminSecure'])) {
        $Sc = explode("|", Xxtea::decrypt($_COOKIE['adminSecure'], $cookie_key_admin));
        if (isset($Sc[1], $Sc[0]) && $_COOKIE['userId'] == $Sc[1] && $_COOKIE['userName'] == $Sc[0]) {
            return true;
        }
    }
    return false;
}
function checkkey()
{
    global $_CKEY;
    $_CKEY = 0;
    $auth_file = ROOT_PATH . "/domain_key.dat";
    if (!file_exists($auth_file)) {
        return false;
        exit;
    }
    $str = @file_get_contents($auth_file);
    $xxtea = new Xxtea();
    $jiamicode = pack('H*', $str);
    $strcode = $xxtea->decrypt($jiamicode, "zzqss");
    $strcode = cookie_authcode($strcode, 'DECODE', "zzqss");
    $strcode = base64_decode($strcode);
    list($shangye, $domainstr) = explode("@", $strcode);
    if (empty($domainstr) || empty($shangye)) {
        return false;
    }
    $strcode = unserialize($domainstr);
    $host = $_SERVER['HTTP_HOST'];
    if (!in_array($host, $strcode)) {
        return false;
        exit;
    } else {
        $_CKEY = 2;
        return true;
    }
}