From 3a34471306d6ea7a7c0447f1209c34a9594bf203 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Sat, 7 Dec 2024 09:10:36 -0500 Subject: [PATCH] ban --- libs/auth.php | 20 +++++++++++++++++--- libs/page.php | 2 +- scripts/init.sql | 3 ++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/libs/auth.php b/libs/auth.php index 3689108..12ee5e7 100755 --- a/libs/auth.php +++ b/libs/auth.php @@ -19,11 +19,25 @@ $result = $stmt->fetch(PDO::FETCH_ASSOC); if (!$result) return null; + + $stmt = $db->prepare("SELECT * FROM main.ban WHERE username = ?"); + $stmt->execute([$username]); - return $username; - } + $result = $stmt->fetch(PDO::FETCH_ASSOC); + if (!$result) return $username; + + $reason = $result['reason']; ?> + + + +

Banned

+

You are banned for .

+ + + \ No newline at end of file +?> diff --git a/libs/page.php b/libs/page.php index 890ab3c..74744ab 100755 --- a/libs/page.php +++ b/libs/page.php @@ -28,4 +28,4 @@ \ No newline at end of file +?> diff --git a/scripts/init.sql b/scripts/init.sql index 4a485d7..ad101b5 100755 --- a/scripts/init.sql +++ b/scripts/init.sql @@ -3,4 +3,5 @@ CREATE TABLE IF NOT EXISTS main.token (username TEXT, token TEXT); CREATE TABLE IF NOT EXISTS main.user (username TEXT, bio TEXT); CREATE TABLE IF NOT EXISTS main.role (username TEXT, role TEXT); CREATE TABLE IF NOT EXISTS main.follow (username TEXT, target TEXT); -CREATE TABLE IF NOT EXISTS main.comment (username TEXT, targetType TEXT, targetId TEXT, date REAL, content TEXT, id TEXT); \ No newline at end of file +CREATE TABLE IF NOT EXISTS main.ban (username TEXT, reason TEXT); +CREATE TABLE IF NOT EXISTS main.comment (username TEXT, targetType TEXT, targetId TEXT, date REAL, content TEXT, id TEXT);