-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete.php
59 lines (35 loc) · 988 Bytes
/
delete.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
<?php
include 'connection.php';
if (is_array($_POST['username'])){
// print_r($_POST);
$username_0 = join(',', $_POST['username']);
$username = "'". str_replace(",","','",$username_0 ) . "'";
$sql = "delete from user where username in($username)";
$result = mysqli_query($conn, $sql);
if ($result) {
echo 'delete successfully!';
header("refresh:2; url= List.php");
exit;
} else {
echo 'delete unsuccessfully!';
header("refresh:2; url= List.php");
exit;
}
}elseif (is_string($_GET['username'])) {
$username ="'" . $_GET['username'] . "'";
$sql = "delete from user where username in($username)";
$result = mysqli_query($conn, $sql);
if ($result) {
echo 'delete successfully!';
header("refresh:3; url= List.php");
exit;
} else {
echo 'delete unsuccessfully!';
header("refresh:2; url= List.php");
exit;
}
}else{
echo 'Illegal data!';
exit;
}
?>