php教程

夸克网盘自动签到php版本

我的站长站 2024-08-14 人阅读

功能介绍

夸克网盘自动签到脚本可以每天自动签到夸克网盘领取奖励,轻松永久

使用方法

将html代码和php代码放入到域名目录下,通过访问html页面,填写“Cookie”进行签到。配合宝塔面板自动任务功能,轻松领取永久容量。

HTML代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>云盘签到</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f4f4f4;
        }
        .container {
            max-width: 600px;
            margin: 50px auto;
            padding: 20px;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        h1 {
            text-align: center;
        }
        form {
            text-align: center;
        }
        label {
            font-weight: bold;
        }
        input[type="text"] {
            width: 80%;
            padding: 8px;
            margin: 10px 0;
            border: 1px solid #ccc;
            border-radius: 4px;
            box-sizing: border-box;
        }
        button[type="submit"] {
            background-color: #4CAF50;
            color: white;
            padding: 10px 20px;
            margin: 10px 0;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        button[type="submit"]:hover {
            background-color: #45a049;
        }
    </style>
    <script>
        function submitForm() {
            var formData = new FormData(document.getElementById("signInForm"));
 
            var xhr = new XMLHttpRequest();
            xhr.open("POST", "sign.php", true);
            xhr.onload = function () {
                if (xhr.status == 200) {
                    alert(xhr.responseText);
                } else {
                    alert("Error: " + xhr.status);
                }
            };
            xhr.send(formData);
            return false; // Prevent default form submission
        }
    </script>
</head>
<body>
    <div>
        <h1>云盘签到</h1>
        <form id="signInForm">
            <label for="cookie">输入Cookie:</label><br>
            <input type="text" id="cookie" name="cookie" required><br>
            <button type="submit">签到</button>
        </form>
    </div>
</body>
</html>

PHP代码:

<?php
 
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $cookie = $_POST["cookie"];
 
    // 获取用户信息
    $userUrl = "https://pan.quark.cn/account/info";
    $userInfo = json_decode(file_get_contents($userUrl, false, stream_context_create([
        'http' => [
            'header' => "Cookie: $cookie\r\n"
        ]
    ])), true)["data"];
 
    if (!$userInfo["nickname"]) {
        echo "登录失败,cookie错误。\n";
        exit();
    }
 
    echo "hello, {$userInfo['nickname']}! 登录成功。\n";
 
    // 查看当前签到状态
    $stateUrl = "https://drive-m.quark.cn/1/clouddrive/capacity/growth/info?pr=ucpro&fr=pc&uc_param_str=";
    $response = json_decode(file_get_contents($stateUrl, false, stream_context_create([
        'http' => [
            'header' => "Cookie: $cookie\r\n"
        ]
    ])), true);
    $sign = $response["data"]["cap_sign"];
 
    if ($sign["sign_daily"]) {
        $number = $sign["sign_daily_reward"] / (1024 * 1024);
        $progress = bcdiv($sign["sign_progress"], $sign["sign_target"], 4) * 100;
        echo "今日已签到获取{$number}MB,进度{$progress}%\n";
        exit();
    }
 
    // 执行签到
    $signUrl = "https://drive-m.quark.cn/1/clouddrive/capacity/growth/sign?pr=ucpro&fr=pc&uc_param_str=";
    $params = [
        "sign_cyclic" => true
    ];
    $options = [
        'http' => [
            'header'  => "Content-Type: application/json\r\n",
            'method'  => 'POST',
            'content' => json_encode($params)
        ]
    ];
    $dataResponse = json_decode(file_get_contents($signUrl, false, stream_context_create($options)), true);
 
    if (isset($dataResponse["error_code"])) { 
        echo "签到失败,请检查cookie是否正常或过期,错误代码: {$dataResponse['error_code']}\n";
        exit(); }
 
    $mb = $dataResponse["data"]["sign_daily_reward"] / 2048;
    echo json_encode($dataResponse) . "\n";
    echo "签到成功,获取到{$mb}MB!\n";
}
?>


php教程标签