-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove_post.php
68 lines (58 loc) · 1.7 KB
/
remove_post.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
<!-- Remove Post.php^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -->
<?php
include 'session-file.php';
include 'database/classes/User.php';
include 'database/classes/Post.php';
$userLoggedIn = $_SESSION['username'];
if(isset($_SESSION['username'])){
$user_details_query = mysqli_query($con, "SELECT * FROM admin WHERE adminname='$userLoggedIn'")or die(mysqli_error($con));
$user = mysqli_fetch_array($user_details_query);
}
else{
header("Location: admin.php");
}
?>
<?php
if(isset($_POST['search_Post_btn']))
{
$Post = $_POST['search'];
$query = mysqli_query($con, "delete from posts where id='$Post'") or die("No Post Found");
if($query){
echo "post no. $Post is Deleted";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Remove Post</title>
<style>
input[type="text"]{
width: 70%;
height: 25px;
padding: 5px;
border-radius: 5px;
border: none;
background: #eeeeee;
padding-left: 10px;
}
input[type="submit"]{
padding: 5px 10px;
background: #7a6bff;
border: none;
border-radius: 3px;
color: white;
height: 32px;
margin-left: 5px;
}
</style>
</head>
<body>
<form action="remove_post.php" method="post">
<input type="text" name="search" placeholder="Enter post ID to remove....">
<input type="submit" name="search_Post_btn" value="Remove">
</form>
</body>
</html>