Add files via upload
This commit is contained in:
53
index.php
Normal file
53
index.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
include "connectionDB.php";
|
||||
include "checkUser.php";
|
||||
if($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
if($_POST["content"] !== "" && strlen($_POST["content"]) < 451) {
|
||||
$add_post->execute(array($_POST["content"], $_COOKIE["userID"]));
|
||||
}
|
||||
}
|
||||
if(!isset($_COOKIE["user"])) {
|
||||
header("Location: /auth.php");
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>TinyTalkHub</title>
|
||||
<link rel="stylesheet" href="css/global.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1><a href="/index.php">TinyTalkHub</a></h1>
|
||||
<div class="form-wrap-post">
|
||||
<form action="/" method="POST" >
|
||||
<textarea maxlength="450" name="content" placeholder="Your message"></textarea>
|
||||
<input name="autor_id" value="<?php echo $_COOKIE["userID"] ?>" type="hidden"></input>
|
||||
<button>Submit</button>
|
||||
</form>
|
||||
|
||||
<a href="/exit.php">Logout from site</a>
|
||||
</div>
|
||||
<div>
|
||||
<?php
|
||||
$posts = $pdo->query($get_posts_query);
|
||||
?>
|
||||
<?php foreach($posts->fetchAll() as $row) { ?>
|
||||
<div class="wrap-posts">
|
||||
<div class="wrap-post-info">
|
||||
<a href="/profile.php?id=<?php echo $row["autor_id"] ?>">
|
||||
Created by <?php echo $row["username"] ?>
|
||||
</a>
|
||||
<p> <?php echo $row["date"] ?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="wrap-post-content">
|
||||
<p> <?php echo $row["content"] ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user