-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdel_user.php
More file actions
27 lines (27 loc) · 809 Bytes
/
del_user.php
File metadata and controls
27 lines (27 loc) · 809 Bytes
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
<!-- Ôàéë îáðàáîòêè óäàëåíèÿ ïîëüçîâàòåëÿ ïî ID -->
<?php
include ('db_connect.php');
$id_del = intval ($_POST['del']);
$query = "SELECT `id`
FROM `users`
WHERE id=$id_del
";
$sql = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($sql)== 0)
{
$error = true;
print '<h4>Íåò ïîëüçîâàòåëÿ ñ òàêèì ID!</h4><a href="list_users.php">Âåðíóòüñÿ</a><br/>';
}
if (strlen($id_del) == 0)
{
$error = true;
print '<h4>Ïîëå ID íå ìîæåò áûòü ïóñòûì!</h4><a href="list_users.php">Âåðíóòüñÿ</a><br/>';
}
if (!$error){
$query_to_del = " DELETE FROM `users`
WHERE id=$id_del
";
$sql_d = mysql_query($query_to_del) or die(mysql_error());
print '<h4>Ïîçäðàâëÿåì, ïîëüçîâàòåëü óñïåøíî óäàëåí!</h4><a href="list_users.php">Âåðíóòüñÿ</a><br/>';
}
?>