52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
<?php
|
|
include "connectionDB.php";
|
|
include "checkUser.php";
|
|
if(!isset($_GET["id"])) {
|
|
header("Location: /index.php");
|
|
}
|
|
else {
|
|
$id = $_GET["id"];
|
|
$get_user_id->execute([$id]);
|
|
$get_posts_count->execute([$id]);
|
|
$user = $get_user_id->fetch();
|
|
$count = $get_posts_count->fetch();
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" href="css/global.css">
|
|
<link rel="icon" type="image/x-icon" href="/favicon-32x32.png">
|
|
<title>TinyTalkHub</title>
|
|
</head>
|
|
<body>
|
|
<h1><a href="/index.php">TinyTalkHub</a></h1>
|
|
|
|
<div class="info-user-wrap">
|
|
<h3>Short info about user</h3>
|
|
<p>Username: <?php echo $user["username"] ?></p>
|
|
<p>Number of posts: <?php echo $count[0] ?></p>
|
|
</div>
|
|
<div>
|
|
<?php
|
|
$get_user_posts->execute([$id]);
|
|
?>
|
|
<?php foreach($get_user_posts->fetchAll() as $row) { ?>
|
|
<div class="wrap-posts">
|
|
<div class="wrap-post-info">
|
|
<p>
|
|
Created by <?php echo $user["username"] ?>
|
|
</p>
|
|
<p> <?php echo $row["date"] ?>
|
|
</p>
|
|
</div>
|
|
<div class="wrap-post-content">
|
|
<p> <?php echo $row["content"] ?></p>
|
|
</div>
|
|
</div>
|
|
<?php }?>
|
|
</div>
|
|
</body>
|
|
</html>
|