header(); if($loggedIn == true) { if($_POST['submit'] ?? "No" == "Update place" || isset($_FILES['userfile']['name']) || isset($_POST['name']) || isset($_POST['description']) || isset($_POST['playerlimit']) && $_POST['playerlimit'] >= 1 ) { $q = $con->prepare("UPDATE FROM games (name, description, creator, players, state, thumbnail) VALUES (:name, :description, :playerlimit, :creator, 'pending', 'empty')"); $q->bindParam(':name',$_POST['name']); $q->bindParam(':description',$_POST['description']); $q->bindParam(':playerlimit',$_POST['playerlimit']); $q->bindParam(':creator',$_SESSION['user'],PDO::PARAM_INT); $q->execute(); } } if(!isset($_GET["id"])) { header("Location: ?id=".$_SESSION['user']); } else { $id = (int)$_GET["id"]; } $q = $con->prepare("SELECT * FROM games WHERE id = :id"); $q->bindParam(':id',$id,PDO::PARAM_INT); $q->execute(); $item = $q->fetch(); $itemUser = new User($con, $item['creator']); if(!$item) { header('location: /error?err=404'); exit; } ?>