-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathposts.php
134 lines (111 loc) · 2.27 KB
/
posts.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
session_start();
include('config.php');
?>
<!-- PHP CODE STARTS HERE -->
<?php
/*
// CHECKING IF A SESSION W'LOGGEDIN HAS BEEN GENERATED
if (!$_SESSION['LoggedIn']) {
echo"<script type='text/javascript'>
alert('YOU ARE NOT LOGGED IN YET!');
window.location.href='index.php';
</script>";
}
*/
$sql = "SELECT * FROM $db_posts_table";
$query = mysqli_query($conn, $sql);
?>
<!-- PHP CODE ENDS HERE -->
<!-- HTML CODE STARTS HERE -->
<!DOCTYPE html>
<html>
<head>
<title>View Posts | Member's Area | Arijit Banerjee</title>
</head>
<body>
<center>
<font face="verdana,arial">
<style type='text/css'>
.a_left {
float: left;
#width:33.33333%;
text-align:left;
}
.a_center {
float: center;
#width:33.33333%;
text-align:center;
}
.a_right {
float: right;
#width:33.33333%;
text-align:right;
}
</style>
<div id='menu'>
<!--<p class='a_left'>Hi <?php echo $_SESSION['admin_username']; ?>, Welcome<p align='right'></p>-->
<?php
if (isset($_SESSION['LoggedIn'])) {
echo "<p class='a_right'>Menu : <a href='home.php'>Home</a> | <a href='profile.php'>My Profile</a> | <a href='create_new_post.php'>Create New Post</a> | <a href='logout.php'>Log Out</a></p>";
}
else {
echo "<p class='a_right'>Menu : <a href='index.php'>LogIn</a> | <a href='registration.php'>Registration</a></p>";
}
?>
</div>
<br><br><br><br>
<style>
table#t1 {
border-collapse: collapse;
}
th, td {
padding: 8px;
}
</style>
<br>
<h2>POSTS</h2>
<br><br>
<table border="1" align="center" id="t1">
<tr>
<th>
Post Number
</th>
<th>
Date and Time
</th>
<th>
Subject
</th>
<th>
Post
</th>
<th>
Posted By
</th>
</tr>
<?php
if (mysqli_num_rows($query) > 0) {
while ($data = mysqli_fetch_assoc($query)) {
if ($data['approved']==1) {
echo "<tr>";
echo "<td><center>". $data['id'] ."</center></td>";
echo "<td><center>". $data['date_time'] ."</center></td>";
echo "<td><center>". $data['subject'] ."</center></td>";
echo "<td>". $data['post'] ."</td>";
echo "<td><center>". $data['posted_by'] ."</center></td>";
echo "</tr>";
}
}
}
else {
echo "<font color='red'>NO DATA FOUND TO SHOW!<br><br></font>";
}
?>
</table>
<br><br>
</font>
</center>
</body>
</html>
<!-- HTMLS CODE ENDS HERE -->