-
Notifications
You must be signed in to change notification settings - Fork 0
/
reply.php
63 lines (58 loc) · 2.11 KB
/
reply.php
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
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
SESSION_START();
require 'info.php';
?>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="DISCIT - Discussion Forum">
<meta name="keywords" content="IITK, DISCIT">
<meta name="viewport" content="width=device-width initial-scale=1.0">
<title>DISCIT: Reply</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand">DISCIT</a>
</div>
<?php
//Checking if user signed in
if($_SESSION['sign_in'])
{
echo '<p class="navbar-text">WELCOME  '.$_SESSION['name'].'</p>
<ul class="nav navbar-nav">
<li><a href="leaderboard.php">LEADER BOARD</a></li>
<li><a href="profile.php">VIEW PROFILE</a></li>
<li><a href="search.php">SEARCH</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="logout.php"><span class="glyphicon glyphicon-log-in"></span> LOG OUT</a></li>
</ul>';
?>
</div>
</nav>
<?php
$sql="INSERT INTO posts(post_op,post_content,post_author,post_date) VALUES('".mysqli_real_escape_string($info, $_POST['id'])."','"
.mysqli_real_escape_string($info, $_POST['post_content'])."','"
.$_SESSION['userid']."',NOW())";
$result=mysqli_query($info,$sql);
if(!$result)
{
echo 'Sorry, your reply could not be saved. Please try again later.';
}
else
{
echo 'Your reply has been successfully saved.';
}
echo '<p><br><br><button type="button"><a href="op.php?id='.$_POST['id'].'">BACK</a></button></p>';
}
else
{
echo '<script type="text/javascript"> alert("YOU ARE NOT LOGGED IN...PLEASE FIRST LOGIN.")</script>';
echo "<script> location.href='login.php'; </script>";
}
?>
</body>
</html>