-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.php
49 lines (42 loc) · 1.57 KB
/
main.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
<!-- the main page/feed that shows the latest posts from all followers -->
<!DOCTYPE html>
<html lang="en">
<head>
<link href="fotoapp.css" rel="stylesheet">
<?php
require('nav.php');
require('db.php');
?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Main page</title>
</head>
<body>
<?php
session_start();
echo "Welcome, user";
echo "<br>";
$sql = "SELECT * FROM `followers`
inner join `post` on post.User = followers.following
WHERE followers.User like '".$_SESSION['username']."'
ORDER BY post.PostTime DESC";
$result = $conn->query($sql);
$likesql = "SELECT * FROM `post_like` where Like_User like '".$_SESSION['username']."'";
$like = $conn->query($likesql);
$likerow = $like -> fetchAll();
while($row = $result -> fetch())
{
require('printpost.php');
require('likebottom.php');
echo "<a href='likeby.php?postid=" . $row['PostID'] . "'>Liked Users</a>";
$commentsql = "SELECT count(Comment) FROM `post_comment` WHERE `Post` = '".$row['PostID']."'";
$commentnum = $conn->query($commentsql);
$num = $commentnum -> fetch();
echo "<a href='comment.php?postid=" . $row['PostID'] . "'>".$num['count(Comment)']." Comments</a>";
echo "<br>";
echo "<br>";
}
?>
</body>
</html>