2024-11-26 11:38:28 -05:00
|
|
|
<?php
|
|
|
|
require("../libs/test_secret.php");
|
|
|
|
|
|
|
|
function auth($token) {
|
2024-11-27 00:13:33 -05:00
|
|
|
if (is_null($token)) return null;
|
2024-11-26 11:38:28 -05:00
|
|
|
|
|
|
|
global $db;
|
|
|
|
|
2024-11-26 23:37:16 -05:00
|
|
|
$stmt = $db->prepare("SELECT * FROM main.token WHERE token = ?");
|
2024-11-26 11:38:28 -05:00
|
|
|
$stmt->execute([$token]);
|
|
|
|
|
|
|
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
2024-11-27 00:13:33 -05:00
|
|
|
if (!$result) return null;
|
2024-11-26 11:38:28 -05:00
|
|
|
|
|
|
|
$username = $result['username'];
|
|
|
|
|
2024-11-26 23:37:16 -05:00
|
|
|
$stmt = $db->prepare("SELECT * FROM main.auth WHERE username = ?");
|
2024-11-26 11:38:28 -05:00
|
|
|
$stmt->execute([$username]);
|
|
|
|
|
|
|
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
2024-11-27 00:13:33 -05:00
|
|
|
if (!$result) return null;
|
2024-12-07 09:10:36 -05:00
|
|
|
|
|
|
|
$stmt = $db->prepare("SELECT * FROM main.ban WHERE username = ?");
|
|
|
|
$stmt->execute([$username]);
|
2024-11-26 11:38:28 -05:00
|
|
|
|
2024-12-07 09:10:36 -05:00
|
|
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if (!$result) return $username;
|
|
|
|
|
|
|
|
$reason = $result['reason']; ?>
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<body>
|
|
|
|
<h1>Banned</h1>
|
|
|
|
<p>You are banned for <?php echo $reason?>.</p>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
<?php die();
|
|
|
|
}
|
2024-11-26 11:38:28 -05:00
|
|
|
|
2024-12-02 07:59:45 -05:00
|
|
|
if (array_key_exists('token',$_COOKIE)) {
|
|
|
|
$username = auth($_COOKIE['token']);
|
|
|
|
}
|
2024-12-07 09:10:36 -05:00
|
|
|
?>
|