All Data Structures Namespaces Files Functions Variables Pages
chat.php
Go to the documentation of this file.
<?php
define('CURSCRIPT', 'chat');
require './include/common.inc.php';
//require_once GAME_ROOT.'./include/JSON.php';
if(!$cuser || !defined('IN_GAME')) {
exit('Not in game.');
}
if(($sendmode == 'send')&&$chatmsg) {
if(strpos($chatmsg,'/') === 0) {
$result = $db->query("SELECT groupid FROM {$tablepre}users WHERE username='$cuser'");
$groupid = $db->result($result);
if($groupid > 1) {
if(strpos($chatmsg,'/post') === 0) {
$chatmsg = substr($chatmsg,6);
if($chatmsg){
$db->query("INSERT INTO {$tablepre}chat (type,`time`,send,msg) VALUES ('4','$now','$cuser','$chatmsg')");
}
} else {
$chatdata = array('lastcid' => $lastcid, 'msg' => Array('<span class="red">指令错误。</span><br>'));
}
} else {
$chatdata = array('lastcid' => $lastcid, 'msg' => Array('<span class="red">聊天信息不能用 / 开头。</span><br>'));
}
} else {
if($chattype == 0) {
$db->query("INSERT INTO {$tablepre}chat (type,`time`,send,msg) VALUES ('0','$now','$cuser','$chatmsg')");
} elseif($chattype == 1) {
$db->query("INSERT INTO {$tablepre}chat (type,`time`,send,recv,msg) VALUES ('1','$now','$cuser','$teamID','$chatmsg')");
}
}
}
if(!$chatdata) {
$chatdata = getchat($lastcid,$teamID);
}
ob_clean();
//$json = new Services_JSON();
//$jgamedata = $json->encode($chatdata);
$jgamedata = compatible_json_encode($chatdata);
echo $jgamedata;
ob_end_flush();
?>
$jgamedata
$jgamedata
Definition: chat.php:42
$chatdata
$chatdata
Definition: game.php:43
getchat
getchat($last, $team='', $limit=0)
Definition: global.func.php:375
$db
$db
Definition: clear.php:32
elseif
【生存者数：<?php echo $alivenum?> 人】< input type="button"value="显示全部幸存者"onClick="$('alivemode').value='all';$('gbmode').value='none';postCmd('alive','alive.php');"></p > if($gamblingon &&$gamestate >=20) elseif($gamblingon &&$gamestate<=10)
Definition: 1_alive.tpl.php:18
$groupid
$groupid
Definition: login.php:115
$result
if(!$cuser||!$cpass) $result
Definition: admin.php:25
compatible_json_encode
compatible_json_encode($data)
Definition: global.func.php:185