-
Notifications
You must be signed in to change notification settings - Fork 228
/
Copy pathchat.php
39 lines (26 loc) · 899 Bytes
/
chat.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
<?php
require_once 'classes/stdf.php';
require_once 'classes/QChat.php';
header('Content-Type: text/html; charset=utf-8');
//$_POST = $_GET;
$uid = get_uid(false);
$cid = isset($_POST['cid'])? $_POST['cid']: '';
$ckey = isset($_POST['ckey'])? $_POST['ckey']: '';
$func = isset($_POST['func'])? $_POST['func']: '';
$attr = isset($_POST['attr'])? $_POST['attr']: '';
if ( empty($uid) || !preg_match('/^[a-zA-Z0-9]{8}$/', $cid) || !preg_match('/^[0-9]{1,9}$/', $ckey) ) {
QChat::error(2, true);
}
$stream = '';
if ( !empty($_POST['stream']) && ($_POST['stream'] == 'hold' || $_POST['stream'] == 'drop') ) {
$stream = $_POST['stream'];
}
$qChat = new QChat($uid, $cid, $ckey);
if ( $stream ) {
$qChat->stream($stream);
} else if ( $func ) {
$attr = json_decode(stripslashes($attr));
if ( !is_null($attr) ) {
$qChat->event($func, $attr);
}
}