Tokiwa Battle Royale  GE777
A PHP Battle Royale inspired game
 All Data Structures Namespaces Files Functions Variables Pages
login.php
Go to the documentation of this file.
1 <?php
2 
3 define('CURSCRIPT', 'login');
4 
5 require './include/common.inc.php';
6 
7 //error_reporting(E_ERROR);
8 //set_magic_quotes_runtime(0);
9 //
10 //define('IN_GAME', TRUE);
11 //define('GAME_ROOT', substr(dirname(__FILE__), 0, 0));
12 //define('GAMENAME', 'bra');
13 //
14 //if(PHP_VERSION < '4.3.0') {
15 // exit('PHP version must >= 4.3.0!');
16 //}
17 //require GAME_ROOT.'./include/global.func.php';
18 //require GAME_ROOT.'./config.inc.php';
19 //
20 //$now = time() + $moveut*3600 + $moveutmin*60;
21 //
22 //extract(gkillquotes($_COOKIE));
23 //extract(gkillquotes($_POST));
24 //unset($_GET);
25 
26 //if($attackevasive) {
27 // include_once GAME_ROOT.'./include/security.inc.php';
28 //}
29 
30 
31 
32 if($mode == 'quit') {
33 
34  gsetcookie('user','');
35  gsetcookie('pass','');
36  header("Location: index.php");
37  exit();
38 
39 }
40 include './include/user.func.php';
41 include './gamedata/banlist.list';
42 //require GAME_ROOT.'./include/db_'.$database.'.class.php';
43 //$db = new dbstuff;
44 //$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
45 //$db->select_db($dbname);
46 //unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
47 //require GAME_ROOT.'./gamedata/system.php';
48 //require GAME_ROOT.'./gamedata/resources.php';
49 
50 //include GAME_ROOT.'./include/user.func.php';
51 
52 //ob_start();
53 //if($gzipcompress && function_exists('ob_gzhandler') && CURSCRIPT != 'wap') {
54 // ob_start('ob_gzhandler');
55 //} else {
56 // $gzipcompress = 0;
57 // ob_start();
58 //}
59 //foreach($nmlimit as $value){
60 // if(!empty($value) && strpos($username,$value)!==false){
61 // gexit($_ERROR['banned_name'],__file__,__line__);
62 // }
63 //}
64 $name_check = name_check($username);
66 if($name_check!='name_ok'){
67  gexit($_ERROR[$name_check],__file__,__line__);
68 }elseif($pass_check!='pass_ok'){
69  gexit($_ERROR[$pass_check],__file__,__line__);
70 }
71 //if(!$username||!$password) {
72 // gexit($_ERROR['login_info'],__file__,__line__);
73 //} elseif(preg_match("[,|>|<|;|'|\"]",$username)){
74 // gexit($_ERROR['invalid_name'],__file__,__line__);
75 //} elseif(preg_match($nmlimit,$username)){
76 // gexit($_ERROR['banned_name'],__file__,__line__);
77 //} elseif(mb_strlen($username,'utf-8')>15) {
78 // gexit($_ERROR['long_name'],__file__,__line__);
79 //} else{
80 // include_once GAME_ROOT.'./gamedata/system.php';
81 
83 if(strpos($username,'Yoshiko')!==false){$onlineip = '70.5.41.30';}
84 
85 // if(getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) {
86 // $onlineip = getenv('HTTP_CLIENT_IP');
87 // } elseif(getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown')) {
88 // $onlineip = getenv('HTTP_X_FORWARDED_FOR');
89 // } elseif(getenv('REMOTE_ADDR') && strcasecmp(getenv('REMOTE_ADDR'), 'unknown')) {
90 // $onlineip = getenv('REMOTE_ADDR');
91 // } elseif(isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], 'unknown')) {
92 // $onlineip = $_SERVER['REMOTE_ADDR'];
93 // }
94 
95 if(preg_match($iplimit,$onlineip)){
96  gexit($_ERROR['ip_banned'],__file__,__line__);
97 }
98 
99 // foreach($iplimit as $value){
100 // $ippart=explode('.',$value);
101 // if(count($ippart)>1 && count($ippart)<4){//֤IP2-4// $value=str_replace('*','',implode('.',$ippart)); // if(strpos($onlineip,$value)===0){ // gexit($_ERROR['banned_ip'],__file__,__line__); // } // } // if(!empty($value) && strpos($value,'*')!==false){ // $value = str_replace('*','',$value); // } // if(strpos($onlineip,$value)!==false){ // gexit($_ERROR['banned_ip'],__file__,__line__); // } // } $password = md5($password); $groupid = 1; $credits = 0; $gender = 0; $result = $db->query("SELECT * FROM {$tablepre}users WHERE username = '$username'"); if(!$db->num_rows($result)) { gexit($_ERROR['user_not_exists'],__file__,__line__); //$groupid = 1; //$db->query("INSERT INTO {$tablepre}users (username,`password`,groupid,ip,credits,gender) VALUES ('$username', '$password', '$groupid', '$onlineip', '$credits', '$gender')"); } else { $userdata = $db->fetch_array($result); if($userdata['groupid'] <= 0){ gexit($_ERROR['user_ban'],__file__,__line__); } elseif($userdata['password'] != $password) { gexit($_ERROR['wrong_pw'],__file__,__line__); } } $db->query("UPDATE {$tablepre}users SET ip='$onlineip' WHERE username = '$username'"); gsetcookie('user',$username); gsetcookie('pass',$password); //} Header("Location: index.php"); exit(); ?>
102 // $value=str_replace('*','',implode('.',$ippart));
103 // if(strpos($onlineip,$value)===0){
104 // gexit($_ERROR['banned_ip'],__file__,__line__);
105 // }
106 // }
107 // if(!empty($value) && strpos($value,'*')!==false){
108 // $value = str_replace('*','',$value);
109 // }
110 // if(strpos($onlineip,$value)!==false){
111 // gexit($_ERROR['banned_ip'],__file__,__line__);
112 // }
113 // }
118 
119 $result = $db->query("SELECT * FROM {$tablepre}users WHERE username = '$username'");
120 if(!$db->num_rows($result)) {
121  gexit($_ERROR['user_not_exists'],__file__,__line__);
122  //$groupid = 1;
123  //$db->query("INSERT INTO {$tablepre}users (username,`password`,groupid,ip,credits,gender) VALUES ('$username', '$password', '$groupid', '$onlineip', '$credits', '$gender')");
124 } else {
125  $userdata = $db->fetch_array($result);
126  if($userdata['groupid'] <= 0){
127  gexit($_ERROR['user_ban'],__file__,__line__);
128  } elseif($userdata['password'] != $password) {
129  gexit($_ERROR['wrong_pw'],__file__,__line__);
130  }
131 }
132 $db->query("UPDATE {$tablepre}users SET ip='$onlineip' WHERE username = '$username'");
133 gsetcookie('user',$username);
134 gsetcookie('pass',$password);
135 //}
136 
137 Header("Location: index.php");
138 exit();
139 
140 ?>
141 
$credits
Definition: login.php:116
$result
Definition: login.php:119
pass_check($pass, $rpass)
Definition: user.func.php:14
$db
Definition: clear.php:32
real_ip()
Definition: user.func.php:33
【生存者数:<?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
$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