forked from zsion/serverchat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
support.php
78 lines (61 loc) · 1.91 KB
/
support.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
// +---------------------------------------------+
// | Copyright 2010 - 2028 WeLive |
// | http://www.weentech.com |
// | This file may not be redistributed. |
// +---------------------------------------------+
define('AUTH', true);
define('AJAX', true);
include('includes/welive.Core.php');
$uid = ForceIncomingInt('uid');
$gid = ForceIncomingInt('gid');
$act = ForceIncomingString('act');
$ajax_last = ForceIncomingFloat('ajax_last');
if(!$uid){
die('Hacking!');
}elseif(ForceIncomingCookie('weliveU'.COOKIE_KEY) != md5(WEBSITE_KEY.$uid.$_CFG['cKillRobotCode'])){
setcookie('weliveU'.COOKIE_KEY, '', 0, '/');
die('Hacking!');
}
$mktime = explode(' ', microtime());
$realtime = $mktime[1];
$minitime = $mktime[0];
$guests = '';
$msgs = '';
switch($act){
case 'offline': //离开页面时设置客服为离线状态
$DB->exe("UPDATE " . TABLE_PREFIX . "user SET isonline = 0 WHERE userid = '$uid'");
refreshCache($uid, 'isonline', '0'); //更新缓存
break;
case 'online':
$DB->exe("UPDATE " . TABLE_PREFIX . "user SET isonline = 1 WHERE userid = '$uid'");
refreshCache($uid, 'isonline', '1'); //更新缓存
WeLiveSend($realtime + $minitime, $guests, $msgs, $ajax_last, $DB->errno);
break;
case 'banned':
if($gid){
$DB->exe("UPDATE " . TABLE_PREFIX . "guest SET isbanned = 1 WHERE guestid = '$gid'");
}
break;
case 'unbanned':
if($gid){
$DB->exe("UPDATE " . TABLE_PREFIX . "guest SET isbanned = 0 WHERE guestid = '$gid'");
}
break;
case 'kickout':
if($gid){
$DB->exe("DELETE FROM " . TABLE_PREFIX . "guest WHERE guestid = '$gid'");
}
break;
case 'iplocation':
$ip = ForceIncomingString('ip');
echo convertip($ip);
break;
case 'setbusy': //设置为忙碌状态
refreshCache($uid, 'isbusy', '1'); //更新缓存
break;
case 'unsetbusy': //解除忙碌状态
refreshCache($uid, 'isbusy', '0'); //更新缓存
break;
}
?>