-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_post.php
More file actions
50 lines (43 loc) · 1.37 KB
/
Copy pathcreate_post.php
File metadata and controls
50 lines (43 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
ob_start();
error_reporting(0);
require "config.php";
require "local_time.php";
session_start();
$reg = $_SESSION["reg"];
$post_id = mt_rand(1,10000);
?>
<!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="ex_css/create_post.css">
<script src="js/jquery.min.js"></script>
<title>Create Post</title>
</head>
<body>
<div class="container">
<form action=""method="post">
<p class="post-details">Post Details:</p>
<textarea name="post"></textarea>
<div class="btn-div"><input type="submit"name="post_submit"value="POST" class="post-btn"></div>
</form>
</div>
<?php
if(isset($_POST["post_submit"]))
{
$post_details = $_POST["post"];
$post_time = $time;
$post_content = $post_details;
$post = "Posted at ".$post_time;
$post.= "<br>$post_content<br><hr><br>";
file_put_contents("users/".$reg."/posts/myposts.txt",$post,FILE_APPEND|LOCK_EX);
$sql = "INSERT INTO posts values($post_id,$reg,'$post_details','$post_time');";
$q = mysqli_query($con,$sql);
exit(header("location:profile.php#resume"));
}
ob_end_flush();
?>
</body>
</html>