-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete.php
More file actions
33 lines (29 loc) · 736 Bytes
/
Copy pathdelete.php
File metadata and controls
33 lines (29 loc) · 736 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
28
29
30
31
32
33
<?php
/**
* delete.php
* Deletes a user.
* The client needs to send:
* - user name
*
* @author Paul
*/
require_once 'conn.php';
$ret = null;
if (isset($_POST['name'])) {
$name = $_POST['name'];
// need to make sure to delete both objects belonging to the user
$redis->del("user:$name");
$redis->del("channels:$name");
// notify everyone the player has left the server
$redis->publish("channel:$name", 'CANCEL');
$redis->publish('channel:all', json_encode(array(
'name' => 'SERVER',
'message' => "$name has left the server"
)));
$ret = array('status' => 'OK');
} else {
$ret = array('err' => 'Missing field age');
}
header('Content-Type: application/json');
echo json_encode($ret);
?>