-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremovepost.php
56 lines (49 loc) · 937 Bytes
/
removepost.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
<html>
<head>
<title>Don Husa</title>
</head>
<body>
<?php
ini_set('display_errors', 'On');
include_once 'dbclass.php';
if ($_POST['formsubmit']=='Submit') removePosts();
else showform();
function deletePost(){
$con=connect();
$sql="DELETE FROM BlogPosts
WHERE ID= '$_POST[blogID]'";
mysql_query($sql,$con);
mysql_close();
}
function deleteComment(){
$con=connect();
$sql="DELETE FROM Comments
WHERE PostID= '$_POST[blogID]'
AND Comment ='$_POST[comment]'";
mysql_query($sql,$con);
mysql_close($con);
}
function removePosts(){
if ($_POST['pwd']!='blargh'){
echo 'incorrect credentials';
return;
}
if ($_POST['posttype']=='deletepost') {
deletePost();
}
else if ($_POST['posttype']=='deletecomment'){
deleteComment();
}
else {
echo "no post type selected...";
include 'addpostform.php';
return;
}
echo 'k';
}
function showform(){
include 'forms/removepostform.php';
}
?>
</body>
</html>