-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeletepost.php
31 lines (28 loc) · 951 Bytes
/
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
<?php
require_once("helper.php");
session_start();
LoginCheck();
$post_id="";
$mypost_info=[];
if(isset($_GET['p'])){
$post_id=$_GET['p'];
}
$mypost_info=fetch_data("SELECT post.id as pid,post.title as post_title,text,link,post.user_id as post_uid,community_name,post.public as post_public, community.public as community_public from post join community on post.community_id=community.id where post.id=$post_id and post.user_id=".$_SESSION['uid']);
if(count($mypost_info)!=1){
$get_host=getHost();
echo "<h1>you cant delete this post </h1>
<script>
setInterval(() => {
window.location.assign('$get_host');
}, 1000);
</script>
";
return ;
}
$res=insert_data('delete from post where id='.$mypost_info[0]['pid'].' and user_id='.$_SESSION['uid']);
if($res['status']){
redirect(getHost().'/profile.php');
}else{
redirect_with_interval('Someting is wrong! ',getHost().'/profile.php');
}
?>