grublox/item.php

43 lines
1.0 KiB
PHP

<?php
session_start();
require_once 'core/classes.php';
require_once 'core/classes/user.php';
$user = new User($con, $_SESSION['user']);
if(!$user->isLoggedIn()) {
header('location: /login');
exit;
}
if(!isset($_GET["id"])) {
header("Location: ?id=".$_SESSION['user']);
} else {
$id = (int)$_GET["id"];
}
$q = $con->prepare("SELECT * FROM catalog WHERE id = :id");
$q->bindParam(':id',$id,PDO::PARAM_INT);
$q->execute();
$item = $q->fetch();
if(!$item) {
header('location: /error?err=404');
exit;
}
?>
<!DOCTYPE html>
<html data-bs-theme="dark">
<head>
<?php
$getitstarted = new PartyStarter;
$getitstarted->header();
?>
</head>
<title><?php echo htmlspecialchars($item["name"]); ?> | <?php echo $sitename; ?></title>
<body>
<h1>yes i am still not hired to make html</h1>
<h1>this item is called <?php echo htmlspecialchars($item["name"]); ?></h1>
<h1>with id <?php echo (int)htmlspecialchars($item["id"]); ?></h1>
<h1>and he costs $<?php echo (int)htmlspecialchars($item["price"]); ?></h1>
<p>thats all i have to say</p>
</body>
</html>