}
function mkcookie($auth_key, $auth_key_ac_sha1)
{
    return 'auth_key=' . $auth_key . '; auth_key_ac_sha1=' . $auth_key_ac_sha1;
}
/*****************************************/
/*                进行签到               */
/*****************************************/
$date = date('Y-m-d');
$st = $db->prepare('SELECT * FROM `' . $dbpre . 'cookie` WHERE last_sign <> ? LIMIT 0,10');
$st->bindValue(1, $date);
$st->execute();
//查询
$st->setFetchMode(PDO::FETCH_ASSOC);
while ($row = $st->fetch()) {
    $qiandao = curl_get('http://www.acfun.tv/member/checkin.aspx', mkcookie($row['auth'], $row['sha1']));
    $qiandao = json_decode($qiandao, 1);
    if (!is_array($qiandao)) {
        echo '<font color="#999999">' . $row['id'] . '</font><br>';
    } elseif (isset($qiandao['status']) && $qiandao['status'] == 401) {
        //删除失效cookie
        $tmp = $db->prepare('DELETE FROM `' . $dbpre . 'cookie` WHERE id = ?');
        $tmp->bindValue(1, $row['id']);
        $tmp->execute();
        echo '<font color="red">' . $row['id'] . '</font><br>';
    } elseif ($qiandao['success'] == TRUE || $qiandao['result'] == '您今天已签到过') {
        //成功
        $tmp = $db->prepare('UPDATE `' . $dbpre . 'cookie` SET last_sign = \'' . $date . '\' WHERE id = ?');
        $tmp->bindValue(1, $row['id']);
        $tmp->execute();
        echo '<font color="green">' . $row['id'] . '</font><br>';
예제 #2
0
파일: login.php 프로젝트: TopGrd/newxb
        die;
    }
    $user_orig = $_POST["user_name"];
    $pass_orig = $_POST["user_pass"];
    $user_name = my_encode($user_orig);
    $user_pass = my_encode($pass_orig);
    $users = file("class/users.php");
    for ($i = 1; $i < count($users); $i++) {
        if (!trim($users[$i])) {
            continue;
        }
        $arr = explode("|", $users[$i]);
        if ($user_name == my_encode($arr[0]) && $user_pass == $arr[1]) {
            mkcookie('user_name', $user_name);
            mkcookie('user_pass', $user_pass);
            mkcookie('last_time', date("D, d M Y H:i:s") . " GMT");
            inlog("登陆成功,用户名:" . $user_orig);
            if ($user_orig == "admin" && $pass_orig == "admin") {
                exit("<script language=javascript>alert(\"欢迎使用 PHPCMS 文件管理器 \\n您是第一次登陆本程序\\n现在请修改默认密码!\");window.location = 'admin.php?action=muser&name=admin';</script>");
            } else {
                ?>
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 <meta http-equiv="refresh" content="1;url=index.php">
 <title><?php 
                echo $title;
                ?>
 --登陆成功</title>
</head>
<body>