-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeed.php
145 lines (120 loc) · 3.72 KB
/
feed.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
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html>
<?php
session_start();
include_once "php/config.php";
if (!isset($_SESSION['unique_id'])) {
header("location: login.php");
}
?>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Feed</title>
<link rel="stylesheet" href="style.css" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<style>
.dropbtn {
display:flex;
padding: 32px;
font-family: 'roboto';
font-size: 2.35rem;
color: gray;
border: none;
box-sizing: border-box;
background-color:white;
}
.dropbtn:hover{
background-color:#f1f1f1;
}
/* Dropdown Content (Hidden by Default) */
.dropdown-content {
text-align: center;
text-decoration: underline;
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 16.72rem;
z-index: 1;
}
/* Links inside the dropdown */
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: #ddd;
}
/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {display: block;}
</style>
</head>
<body style="font-family:'roboto';">
<div class="header">
<div class="lheader">
<img src="images/pic1.png" alt="" />
<!-- <div class="headerinp">
<span class="material-icons"> search </span>
<input type="text" placeholder="Search... " />
</div> -->
</div>
<div class="header__middle">
<div class="header__option active">
<a style="font-family:'roboto';" class="material-icons" href="feed.php">
<h3>HOME</h3>
</a>
</div>
<div class="header__option">
<a style="font-family:'roboto';" class="material-icons" href="users.php">
<h3>CHAT</h3>
</a>
</div>
<div class="header__option">
<a style="font-family:'roboto';" class="material-icons" href="postimage.php">
<h3>POST</h3>
</a>
</div>
<div class="dropdown">
<button class="dropbtn"><u><strong>MINIGAMES</strong></u></button>
<div class="dropdown-content">
<a href="baseSnake.html">Snake</a>
<a href="rps.html">Rock Paper Scissors</a>
</div>
</div>
<div class="header__option">
<a style="font-family:'roboto';" class="material-icons" href="mid_logout.php">
<h3>LOGOUT</h3>
</a>
</div>
</div>
<div class="rheader">
<div class="header__info">
<?php
$sql = mysqli_query($conn, "SELECT * FROM users WHERE unique_id = {$_SESSION['unique_id']}");
if (mysqli_num_rows($sql) > 0) {
$row = mysqli_fetch_assoc($sql);
}
?>
<img class="user__avatar" src="php/images/<?php echo $row['img']; ?>" alt="">
<div class="details">
<h3><?php echo $row['fname'] . " " . $row['lname'] ?></h3>
</div>
<!-- <img class="user__avatar" src="images/pfp.png" alt="" />
<h3>[firstName] [lastName]</h3> -->
</div>
</div>
</div>
</div>
<?php
$sql = mysqli_query($conn, "SELECT * FROM posts ORDER BY time_posted DESC");
while($row = mysqli_fetch_assoc($sql)) {
echo "
<div class='post' style='width:80%'><div class='post__top'>
<div class='post__topInfo'><h3>".$row["fname"]." ".$row["lname"]."</h3><p>".$row["time_posted"]."</p></div></div><div class='post__bottom'><p>".$row["text_content"]."</p></div>";
echo "<div class='post__image'><img src='php/images/".$row["img_content"]."'/></div></div></center>";
}
?>
</div>
</body>
</html>