-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlog.php
More file actions
136 lines (122 loc) · 5.08 KB
/
Blog.php
File metadata and controls
136 lines (122 loc) · 5.08 KB
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
<?php require_once("include/DB.php"); ?>
<?php require_once("include/Sessions.php"); ?>
<?php require_once("include/Functions.php"); ?>
<?php
if(isset($_GET["ClappedOn"])){
$ConnectingDB;
$PostId = $_GET["ClappedOn"];
$CountClapsQuery = "SELECT COUNT(*) FROM claps
WHERE admin_panel_id='$PostId' ";
$ExecuteClapQuery = $Connection->query($CountClapsQuery);
$ClapsCount = $ExecuteApproved->fetch_assoc();
$TotalClaps = $ExecuteClapQuery->fetch_assoc()['COUNT(*)'];
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TechVents | Blog</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="js/search.js" ></script>
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" integrity="sha256-h20CPZ0QyXlBuAw7A+KluUYx/3pK+c7lYEpqLTlxjYQ=" crossorigin="anonymous" />
</head>
<script>
$(document).ready(function(){
$.ajax({
type: "POST",
url: "Search.php",
data: {
Search: 'everything',
},
success: function (html) {
$("#display").html(html).show();
},
});
})
</script>
<body>
<?php include("base.php"); ?>
<div class="body-container">
<div class="post-listing">
<?php echo Message(); echo SuccessMessage(); ?>
<div class="" id="display"></div>
<!-- For loop idhar aayega -->
</div>
<!-- Right Panel -->
<div class="right-panel">
<!-- About Me -->
<div class="about-me">
<?php
if(isset($_SESSION["Username"])){ ?>
<img src="https://img.icons8.com/ios-filled/150/000000/user-male-circle.png" alt="user-img"/>
<p><b><?php echo $_SESSION["Username"] ?></b></p>
<hr>
<?php
if($_SESSION['Role']=="User"){
echo '<p><a href="dashboard_user.php"> My Dashboard </a></p>';
echo '<p><a href="AddNewPost_User.php"> Write a Post </a></p>';
}
if($_SESSION['Role']=="Admin"){
echo '<p><a href="dashboard.php"> My Dashboard </a></p>';
echo '<p><a href="AddNewPost.php"> Write a Post </a></p>';
}
?>
<?php }
?>
</div>
<!-- Categories -->
<div class="category-container">
<h4>Categories</h4>
<div class="category-content">
<span>
<button type="submit" class="category" value="all">All</button>
</span>
<?php
$ConnectingDB;
$ViewQuery = "SELECT * FROM category ORDER BY datetime desc";
$Execute = $Connection->query($ViewQuery);
while($DataRows = $Execute->fetch_assoc()){
$Id = $DataRows['id'];
$Category = $DataRows['name'];
?>
<span>
<button type="submit" class="category" id="<?php echo $Category; ?>">
<?php echo $Category; ?>
</button>
</span>
<?php } ?>
</div>
</div>
<!-- Recent Posts -->
<div class="recent-posts-container">
<h4>Recent Posts</h4>
<div class="recent-posts-content">
<?php
$ConnectingDB;
$ViewQuery = "SELECT * FROM admin_panel ORDER BY id desc LIMIT 0,5";
$Execute = $Connection->query($ViewQuery);
while($DataRows = $Execute->fetch_assoc()){
$Id = $DataRows["id"];
$Title = $DataRows["title"];
$DateTime = $DataRows["datetime"];
$Image = $DataRows["image"];
if(strlen($DateTime)>11){ $DateTime = substr($DateTime,0,17);}
if(strlen($Title)>11){ $Title = substr($Title,0,40).'...'; }
?>
<div class="recent-postt">
<img src="./uploads/<?php echo htmlentities($Image); ?>" alt="Post-Image">
<div class="recent-post">
<p><a href="FullPost.php?id=<?php echo $Id; ?>"><?php echo htmlentities($Title); ?></a></p>
<p id="time"><?php echo htmlentities($DateTime) ?></p>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</body>
</html>