grublox/user.php

60 lines
1.7 KiB
PHP

<?php
session_start();
require_once 'core/classes.php';
require_once 'core/classes/user.php';
if(isset($_SESSION['user'])) {
$user = new User($con, $_SESSION['user']);
}
// some shitty code by nolanwhy
// yes i coded all of this inside github editor
if(!isset($_GET["id"])) {
header("Location: ?id=".$_SESSION['user']);
} else {
$id = (int)$_GET["id"];
}
$q = $con->prepare("SELECT * FROM users WHERE id = :id");
$q->bindParam(':id',$id,PDO::PARAM_INT);
$q->execute();
$requestUser = $q->fetch();
if(!$requestUser) {
die("go fuck yourself (can't find user)"); // todo: redirect to 404
}
?>
<!DOCTYPE html>
<html data-bs-theme="dark">
<head>
<?php
$getitstarted = new PartyStarter;
$getitstarted->header();
?>
</head>
<title><?php echo htmlspecialchars($requestUser["username"]); ?> | <?php echo $sitename; ?></title>
<body>
<main class="container" style="width: 100%;">
</main>
<main class="container text-white" style="width: 100%;">
<br>
<br>
<div class="card shadow-sm">
<div class="card-body">
<img src="assets/renders/user/headshot?userId=<?php echo (int)htmlspecialchars($requestUser["id"]); ?>" class="border border-1 float-start me-3" width=125 height=125></img>
<span class="fs-2"><?php echo htmlspecialchars($requestUser["username"]); ?><br>
<span class="text-muted fs-5 float-start">"i love sex grublox"</span></span><br>
<div class="text-center float-start" style="width: 8rem;">
<h5>Friends</h5>
<h5 class="text-muted">0</h5>
</div>
<div class="text-center float-start" style="width: 8rem;">
<h5>Tokens</h5>
<h5 class="text-muted"><?php echo (int)htmlspecialchars($requestUser["money"]); ?></h5>
</div>
<a class="btn btn-primary float-end mt-4">Add friend</a>
</div>
</div>
</main>
</body>
</html>