-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathuserDelete.php
43 lines (35 loc) · 1.3 KB
/
userDelete.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
<?php
/**
* Apache License 2.0
* @author Trapenok Victor, [email protected], 89244269357
* I will be glad to new orders for the development of anything.
*
* Skype:Levhav
* 89244269357
*
* https://github.com/Levhav/Star.Comet-Chat
*/
include './config.php';
include './common.php';
testIpOrDie();
$user_id = (int)$_GET['id'];
$result = mysqli_query(StarCometChat::conf()->getDB(), "SELECT * FROM `messages` where (from_user_id = ".$user_id." or to_user_id = ".$user_id.") and message like \"[[img%\"");
if(mysqli_num_rows($result))
{
while($row = mysqli_fetch_assoc($result))
{
$msg = preg_replace("/\[\[img=(.*)\]\]/", getConfArray('file_dir')."/$1", $row['message']);
if(@unlink($msg))
{
echo "Successfully deleted:".$msg."\n";
}
else
{
echo "Failed to delete: ".$msg."\n";
}
}
}
mysqli_query(StarCometChat::conf()->getDB(), "delete FROM `messages` where from_user_id = ".$user_id." or to_user_id = ".$user_id."");
mysqli_query(StarCometChat::conf()->getDB(), "delete FROM `users_relations` WHERE user_id = ".$user_id." or to_user_id = ".$user_id."");
mysqli_query(StarCometChat::conf()->getDB(), "delete FROM `abuse` where `user_id_from` = ".$user_id." or `user_id_to` = ".$user_id." ");