Tokiwa Battle Royale  GE777
A PHP Battle Royale inspired game
 All Data Structures Namespaces Files Functions Variables Pages
chat.php
Go to the documentation of this file.
1 <?php
2 
3 define('CURSCRIPT', 'chat');
4 
5 require './include/common.inc.php';
6 //require_once GAME_ROOT.'./include/JSON.php';
7 
8 if(!$cuser || !defined('IN_GAME')) {
9  exit('Not in game.');
10 }
11 
12 if(($sendmode == 'send')&&$chatmsg) {
13  if(strpos($chatmsg,'/') === 0) {
14  $result = $db->query("SELECT groupid FROM {$tablepre}users WHERE username='$cuser'");
15  $groupid = $db->result($result);
16  if($groupid > 1) {
17  if(strpos($chatmsg,'/post') === 0) {
18  $chatmsg = substr($chatmsg,6);
19  if($chatmsg){
20  $db->query("INSERT INTO {$tablepre}chat (type,`time`,send,msg) VALUES ('4','$now','$cuser','$chatmsg')");
21  }
22  } else {
23  $chatdata = array('lastcid' => $lastcid, 'msg' => Array('<span class="red">指令错误。</span><br>'));
24  }
25  } else {
26  $chatdata = array('lastcid' => $lastcid, 'msg' => Array('<span class="red">聊天信息不能用 / 开头。</span><br>'));
27  }
28  } else {
29  if($chattype == 0) {
30  $db->query("INSERT INTO {$tablepre}chat (type,`time`,send,msg) VALUES ('0','$now','$cuser','$chatmsg')");
31  } elseif($chattype == 1) {
32  $db->query("INSERT INTO {$tablepre}chat (type,`time`,send,recv,msg) VALUES ('1','$now','$cuser','$teamID','$chatmsg')");
33  }
34  }
35 }
36 if(!$chatdata) {
37  $chatdata = getchat($lastcid,$teamID);
38 }
39 ob_clean();
40 //$json = new Services_JSON();
41 //$jgamedata = $json->encode($chatdata);
43 echo $jgamedata;
44 ob_end_flush();
45 
46 
47 ?>
$jgamedata
Definition: chat.php:42
$chatdata
Definition: game.php:43
getchat($last, $team='', $limit=0)
$db
Definition: clear.php:32
【生存者数:<?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
Definition: login.php:115
if(!$cuser||!$cpass) $result
Definition: admin.php:25
compatible_json_encode($data)