forked from oioki/asterisk-users-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete.php
38 lines (28 loc) · 960 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
<?php
require 'auth.php';
require 'adminaccess.php';
$name = $_GET['name'];
if ( !preg_match('/^[0-9]{3,4}/', $name) ) return;
switch( $_GET['s'] )
{
case 'user':
$sql = "INSERT INTO `sip_deleted` SELECT `name`,`fullname`,`fio`,`context`,`secret` FROM `sip_users` WHERE `name` = ?";
$sth = $dbh->prepare($sql);
$sth->execute(array($name)) or die( $sql );
$sql = "DELETE FROM `sip_users` WHERE `name` = ?";
$sth = $dbh->prepare($sql);
$sth->execute(array($name)) or die( $sql );
$ami->login();
$r = $ami->sendCommand("Action: Command\r\nCommand: sip prune realtime peer $nameold\r\n\r\n");
Header("Location: .");
break;
case 'ext':
$sql = "DELETE FROM `sip_extensions` WHERE `name` = ?";
$sth = $dbh->prepare($sql);
$sth->execute(array($name)) or die( $sql );
Header("Location: .");
break;
default:
break;
}
?>