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 <?php
include("./res/global.php");
session_start(); 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)
{ {
fail:
echo "nope";
header("Location: ./index.php"); header("Location: ./index.php");
return; return;
} }
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="cs"> <html lang="cs">
<head> <head>