<?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) {
  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($requestUser["username"]); ?> | <?php echo $sitename; ?></title>
<body>
<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>
<br>
<div class="card shadow-sm">
      <div class="card-body">
<ul class="nav justify-content-center">
  <li class="nav-item fs-5" style="margin-right: 25%">
    <a class="nav-link" href="#about">About</a>
  </li>
  <li class="nav-item fs-5" style="margin-left: 25%">
    <a class="nav-link" href="#games">Creations</a>
  </li>
</ul>
</div>
</div>
<h3 class="mt-3">About</h3>

<div class="card shadow-sm">
 <div class="card-body">
  <p>Hello i am new to roblo, dfdsdfsddfsdd, Hello i am new to roblo, dfdsdfsddfsdd, Hello i am new to roblo, dfdsdfsddfsdd, </p>
  <hr>
  <a href="/report?type=user&id=<?php echo $id; ?>" class="text-danger float-end text-decoration-none">Report Abuse</a>
 </div>
</div>
<h3 class="mt-3">Currently wearing</h3>

<div class="card shadow-sm float-start w-50 border-end-0 rounded-end-0 mb-4" style="height: 350px">
 <div class="card-body mx-auto">
  <img src="/assets/renders/user/thumbnail?userId=1" height=350>
  <a class="btn btn-light position-absolute top-0 end-0 mt-2 me-2">3D</a>
 </div>
</div>

<!-- items !-->
<div class="card shadow-sm float-end w-50 border-start-0 rounded-start-0 bg-primary mb-4" style="height: 350px">
 <div class="card-body">
  <div class="row row-cols-1 row-cols-md-4 g-4 mx-auto">
   <a href="/item?id=" class="card shadow-sm bg-light me-3" style="height: 136px; width: 136px;"></a>
  </div>
</div>
 </div>


<div class="card shadow-sm">
      <div class="card-body mx-auto">
 <div class="card-group">
  <div class="text-center float-start ms-5 me-5">
   <h5>Join Date</h5>
   <h5 class="text-muted"><?php echo htmlspecialchars($requestUser["date"]); ?></h5>
  </div>
  <div class="text-center ms-5 me-5">
   <h5>Place Visits</h5>
   <h5 class="text-muted">0</h5>
  </div>
  <div class="text-center float-end ms-5 me-5">
   <h5>Forum posts</h5>
   <h5 class="text-muted">0</h5>
  </div>
 </div>
</div>

</main>
</body>
</html>
