输入卡密才能访问

if(isset($_POST['submit'])) { // 判断是否点击了提交按钮 $card = $_POST['card']; // 获取输入的卡密 $sql = "SELECT * FROM cards WHERE card='$card'"; // SQL语句 $result = $conn->query($sql);

if ($result->num_rows > 0) { // 如果查询到结果
    $row = $result->fetch_assoc();
    $expire = strtotime($row['expire']);
    $now = strtotime(date("Y-m-d H:i:s"));

    if($expire > $now) { // 如果卡密未过期
        $days = $row['days'];
        header("Location: index.html"); // 跳转至主页
    } else { // 如果卡密已过期
        echo "卡密已过期,<a href='contact.html'>联系客服</a>购买。"; // 提示购买卡密
        echo "<br><a href='index.html'>返回主页</a>"; // 提供返回主页链接
    }
} else { // 如果未查询到结果
    echo "卡密无效,请重新输入。";
    echo "<br><a href='index.html'>返回主页</a>"; // 提供返回主页链接
}

$conn->close(); // 关闭数据库连接

} ?>

!DOCTYPE htmlhtmlhead title输入卡密才能访问title meta charset=UTF-8headbody center form method=post action=checkphp label for=card请输入卡密:label input type=text name=card id=card requir

原文地址: http://www.cveoy.top/t/topic/LMm 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录