added user existence check to forum

This commit is contained in:
Václav Šmejkal 2024-05-22 16:06:17 +02:00
parent 6257ba0d52
commit 9ac2f5c563
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -1,12 +1,21 @@
<?php
include("./res/global.php");
session_start();
if (!isset($_SESSION["username"]))
if (!isset($_SESSION["username"])) goto fail;
$out = $database -> query("SELECT username FROM user WHERE BINARY username=\"" . $_SESSION["username"] . "\"");
if ($out -> num_rows != 1)
{
header("Location: ./index.php");
return;
fail:
echo "nope";
header("Location: ./index.php");
return;
}
?>
<!DOCTYPE html>
<html lang="cs">
<head>