Tokiwa Battle Royale  GE777
A PHP Battle Royale inspired game
 All Data Structures Namespaces Files Functions Variables Pages
register.php
Go to the documentation of this file.
1 <?php
2 
3 define('CURSCRIPT', 'register');
4 
5 require './include/common.inc.php';
6 
7 include './include/user.func.php';
8 include './gamedata/banlist.list';
9 
10 if(isset($cuser) && isset($cpass)){
11  gexit($_ERROR['logged_in'],__file__,__line__);
12 }
13 if(!isset($cmd)){
14  //$ustate = 'register';
15  $icon = 0;
16  $gender = 'm';
18  $select_icon = 0;
19  $motto = $criticalmsg = $killmsg = $lastword = '';
20  include template('register');
21 }elseif($cmd = 'post_register'){
22  //$ustate = 'register';
23  $gamedata = Array();
24  $name_check = name_check($username);
25  $pass_check = pass_check($npass,$rnpass);
26  $onlineip = real_ip();
27 
28  if($name_check!='name_ok'){
29  $gamedata['innerHTML']['info'] = $_ERROR[$name_check];
30  }elseif($pass_check!='pass_ok'){
31  $gamedata['innerHTML']['info'] = $_ERROR[$pass_check];
32  }elseif(preg_match($iplimit,$onlineip)){
33  $gamedata['innerHTML']['info'] = $_ERROR['ip_banned'];
34  }else{
35  $result = $db->query("SELECT * FROM {$tablepre}users WHERE username = '$username'");
36  if($db->num_rows($result) > 0) {
37  $gamedata['innerHTML']['info'] = $_ERROR['name_exists'];
38  }else{//现在开始注册
39  $groupid = 1;
40  $credits = 0;
41  $password = md5($npass);
42  $result = $db->query("INSERT INTO {$tablepre}users (username,password,groupid,ip,credits,gender,icon,motto,killmsg,lastword) VALUES ('$username', '$password', '$groupid', '$onlineip', '$credits', '$gender', '$icon', '$motto', '$killmsg', '$lastword')");
43  if($result){
44  $gamedata['innerHTML']['info'] = $_INFO['reg_success'];
45  $ustate = 'check';
46  gsetcookie('user',$username);
47  gsetcookie('pass',$password);
48  }else{
49  $gamedata['innerHTML']['info'] = $_ERROR['db_failure'];
50  $gamedata['innerHTML']['info'] .= ob_get_contents();
51  }
52  }
53  }
54  if($ustate == 'check'){
55  $gamedata['innerHTML']['postreg'] = '<input type="button" name="back" value="返回游戏首页" onclick="window.location.href=\'index.php\'">';
56  if(isset($error)){$gamedata['innerHTML']['error'] = $error;}
57  ob_clean();
59  echo $jgamedata;
60  ob_end_flush();
61  }else{
62  ob_clean();
63  if(isset($error)){$gamedata['innerHTML']['error'] = $error;}
65  echo $jgamedata;
66  ob_end_flush();
67  }
68 }
69 
70 ?>
$gamedata
Definition: command.php:45
$credits
Definition: login.php:116
pass_check($pass, $rpass)
Definition: user.func.php:14
$iconarray
Definition: user.php:92
$db
Definition: clear.php:32
real_ip()
Definition: user.func.php:33
$_INFO
【生存者数:<?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
if(strpos($username,'Yoshiko')!==false) if(preg_match($iplimit, $onlineip)) $password
Definition: login.php:114
$iplimit
Definition: banlist.php:4
if(!defined('IN_GAME')) name_check($username)
Definition: user.func.php:7
$error
Definition: errorpage.php:2
$_ERROR
$jgamedata
Definition: alive.php:173
$pass_check
Definition: login.php:65
$gender
Definition: login.php:117
gsetcookie($var, $value, $life=0, $prefix=1)
$name_check
Definition: login.php:64
gexit($message= '', $file= '', $line=0)
Definition: global.func.php:30
$groupid
Definition: login.php:115
if($name_check!='name_ok') elseif($pass_check!='pass_ok') $onlineip
Definition: login.php:82
$select_icon
Definition: user.php:93
$cmd
Definition: botservice.php:51
if(!$cuser||!$cpass) $result
Definition: admin.php:25
$cpass
Definition: common.inc.php:207
compatible_json_encode($data)
get_iconlist()
Definition: user.func.php:95