-
Notifications
You must be signed in to change notification settings - Fork 0
/
deletepost.php
172 lines (172 loc) · 6.91 KB
/
deletepost.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
include "session.php";
include "style/adminDashboard_style.php";
require_once "database.php";
if(!isset($_SESSION["user_id"]))
{
$_SESSION["errormessage"]="Login Required";
header("location:login.php");
exit;
}
?>
<?php
if(isset($_POST["delete"]))
{
$delete_id=$_GET["delete_id"];
$query="delete from admin_panel where id='$delete_id'";
$execute=mysql_query($query);
if($execute)
{
$_SESSION["successmessage"]="Post deleted Successfully";
header('Location: /blog/AdminDashboard.php');
exit;
}
else
{
$_SESSION["errormessage"]="Oops Something went wrong.Post failed to delete.Please try after some time.";
header('Location: /blog/AdminDashboard.php');
exit;
}
}
?>
<html>
<head>
<title>Delete Post</title>
</head>
<body>
<div style="height:10px; background-color:#27aae1;"></div>
<nav class="navbar navbar-inverse" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#collapse"><!-- java script not working. data-toggle and data-target are function of javascript -->
<span class="sr-only">Toggle-Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="blog.php"><img style="margin-top:-15px"src="images/spiddy.jpg" width=115;height=20;></a>
</div>
<div class="collapse navbar-collapse" id="collapse">
<ul class="nav navbar-nav">
<li><a href="#">Home</a></li>
<li><a href="blog.php">Blog</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact Us</a></li>
<li><a href="#">Features</a></li>
</ul>
<form action="blog.php" class="navbar-form navbar-right">
<div class="form-group">
<input class="form-control"type="text" name="search" placeholder="Search" required>
</div>
<button class="btn btn-default" name="searchbtn">Go</button>
</form>
</div>
</div>
</nav>
<div class="line"style="height:10px; background-color:#27aae1;"></div>
<div class="container-fluid">
<div class="row">
<div class="col-sm-2">
<h4 style="color:#ffffff">Spiddy Creations</h4>
<ul id="side_menu"class="nav nav-pills nav-stacked">
<li>
<a href="AdminDashboard.php"><span class="glyphicon glyphicon-th"></span> Dashboard</a>
</li>
<li>
<a href="addnewpost.php"><span class="glyphicon glyphicon-list-alt"></span> Add New Post</a>
</li>
<li>
<a href="categories.php"><span class="glyphicon glyphicon-tags"></span> Categories</a>
</li>
<li>
<a href="admin.php"><span class="glyphicon glyphicon-user"></span> Manage Admins</a>
</li>
<li>
<a href="comments.php"><span class="glyphicon glyphicon-comment"></span> Comments
<?php
$comment_query="select count(*) from comments where status='OFF'";
$comment_execute=mysql_query($comment_query);
$comment_row=mysql_fetch_array($comment_execute);
$disapproved_comments=array_shift($comment_row);
?>
<span class="label pull-right label-warning"><?php if($disapproved_comments != 0) echo $disapproved_comments; ?></span>
</a>
</li>
<li>
<a href="#"><span class="glyphicon glyphicon-equalizer"></span> Live Blog</a>
</li>
<li>
<a href="logout.php"><span class="glyphicon glyphicon-log-out"></span> Log Out</a>
</li>
</ul>
</div>
<div class="col-sm-10">
<h1>Delete Post</h1>
<?php echo errormessage(); echo successmessage();?>
<div>
<?php
$delete_id=$_GET["delete_id"];
$query="select * from admin_panel where id = '$delete_id'";
$execute=mysql_query($query);
while($row=mysql_fetch_array($execute))
{
$title_to_be_updated=$row["title"];
$category_to_be_updated=$row["category"];
$post_to_be_updated=$row["post"];
$image_to_be_updated=$row["image"];
}
?>
<form action="deletepost.php?delete_id=<?php echo $delete_id;?>" method="post" enctype="multipart/form-data">
<fieldset>
<div class="form-group">
<label for="title"><span style="color:rgb(251,174,44);font-family:Bitter;font-size:1.2em;">Title: </span></label>
<input disabled value="<?php echo $title_to_be_updated; ?>" class="form-control" type="text" name="title" id="title" placeholder="Title">
</div>
<div class="form-group">
<span style="color:rgb(251,174,44);font-family:Bitter;font-size:1.2em;">Current Category : <?php echo $category_to_be_updated;?></span><br>
<label for="categoryselect"><span style="color:rgb(251,174,44);font-family:Bitter;font-size:1.2em;">Category: </span></label>
<select disabled class="form-control" id="categoryselect" name="category">
<?php
$query="select * from category order by datetime desc";
$execute=mysql_query($query);
while($row=mysql_fetch_array($execute))
{
$id=$row["id"];
$name=$row["name"];?>
<option><?php echo $name ?></option><?php
}
?>
</select>
</div>
<div class="form-group">
<span style="color:rgb(251,174,44);font-family:Bitter;font-size:1.2em;">Current Image <img src="image_upload/<?php echo $image_to_be_updated;?>" width="50px" height="70px"></span><br>
<label for="imageselect"><span style="color:rgb(251,174,44);font-family:Bitter;font-size:1.2em;">Select Image: </span></label>
<input disabled class="form-control" type="file" name="image" id="imageselect" placeholder="Select Image">
</div>
<div class="form-group">
<label for="postarea"><span style="color:rgb(251,174,44);font-family:Bitter;font-size:1.2em;">Post: </span></label>
<textarea disabled class="form-control" type="text" name="post" id="post" >
<?php echo $post_to_be_updated; ?>
</textarea>
</div>
<br>
<input class="btn btn-danger btn-block" type="submit" name="delete" value="Delete"></input>
</fieldset><br>
</form>
</div>
</div>
</div>
</div>
<div id="footer">
<hr><p>Theme By | Harshit Gupta | ©2016-2020 --- All right reserved.</p>
<a style="color:white;text-decoration:none;cursor:pointer;font-weight:bold;"href="">
<p>
This site is only use for study purpose spiddy creations have all right reserved.No one is allowed to distribute
copies other than <br> ™ spiddycreations.com ™ Udemy ; ™ Skillshare; ™ StackSkills
</p><hr> </a>
</div>
<div style="height:10px; background:#27aae1">
</div>
</body>
</html>