-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompiler.html
87 lines (62 loc) · 2.15 KB
/
compiler.html
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
<?php
include "header.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="blog.css?v=<?php echo time(); ?>">
<title>Blog</title>
</head>
<body>
<div class="link">
<a href="upload-post.php?id=<?php
echo $_SESSION['user_id'];
if(!isset($_SESSION['user_id'])){
header("Location: http://localhost/project/login.php");
}
?>" class="upload_post_link">Upload post</a>
</div>
<?php
include "connection.php";
// $sql = "SELECT * FROM post order by post_id desc";
$sql = "SELECT *
FROM post
INNER JOIN users ON post.author= users.id";
$result = mysqli_query($conn,$sql);
if(mysqli_num_rows($result) <= 0 ){
echo "<p>No records found</p>";
}
else{
while($row = mysqli_fetch_assoc($result)){
echo "<br>";
$image = $row['post_img'];
?>
<div class="blog">
<div class="img">
<img class="" src="upload/<?php echo $image; ?>" width="150" height="150" alt="Blog post">
</div>
<div class="blog_content">
<?php
if($row['author']==$_SESSION['user_id']){
echo '<a href="Delete-post.php?id=$row["post_id"]" class="btn">Delete</a>';
echo '<a href="Update" class="btn">Update</a>';
}
?>
<a href="Catogory" class="btn"> <?php echo $row['category']; ?></a>
<p class="Title"> <?php echo $row['title']; ?></p>
<p class="Description"> <?php echo $row['description']; ?></p>
<p class="Author"> <?php echo $row['username']; ?></p>
<p class="post_time"> <?php echo $row['post_date']; ?></p>
</div>
</div>
<?php
}
}
?>
</body>
</html>
echo "<a href='Delete-post.php?id={$row['post_id']}' class='inline-flex text-center text-gray-100 py-1 px-3 rounded-full bg-purple-600 hover:bg-purple-700 transition duration-150 ease-in-out'>Update</a>";
echo '</li>';