function write_valid_limit($dir, $nmlmtstr, $iplmtstr) { foreach (array('nm', 'ip') as $ar_nm) { ${$ar_nm . 'lmtarray'} = explode('|', ${$ar_nm . 'lmtstr'}); ${$ar_nm . 'lmtlist0'} = ${$ar_nm . 'lmtlist'} = ''; foreach (${$ar_nm . 'lmtarray'} as $value) { ${$ar_nm . 'lmtlist'} .= "'{$value}',"; } if (${$ar_nm . 'lmtlist0'} != ${$ar_nm . 'lmtlist'}) { ${$ar_nm . 'lmtlist'} = 'Array(' . substr(${$ar_nm . 'lmtlist'}, 0, -1) . ')'; } else { ${$ar_nm . 'lmtlist'} = 'Array()'; } } $vldata = "<?php\n\n\$nmlimit = {$nmlmtlist};\n\$iplimit = {$iplmtlist};\n\n?>"; if ($fp = fopen("{$dir}banlist.list", 'w')) { if (flock($fp, LOCK_EX)) { fwrite($fp, $vldata); } else { exit("Couldn't save the game's info !"); } fclose($fp); } else { gexit('Can not write to cache files, please check directory ./gamedata/ .', __FILE__, __LINE__); } return; }
function parse_template($file, $templateid, $tpldir) { global $language; $nest = 5; $tplfile = GAME_ROOT . "./{$tpldir}/{$file}.htm"; $objfile = GAME_ROOT . "./gamedata/templates/{$templateid}_{$file}.tpl.php"; if (!($fp = fopen($tplfile, 'r'))) { gexit("Current template file './{$tpldir}/{$file}.htm' not found or have no access!"); } elseif (!(include_once language('templates', $templateid, $tpldir))) { gexit("<br>Current template pack do not have a necessary language file 'templates.lang.php' or have syntax error!"); } $template = fread($fp, filesize($tplfile)); fclose($fp); $var_regexp = "((\\\$[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*)(\\[[a-zA-Z0-9_\\-\\.\"\\'\\[\\]\$-ÿ]+\\])*)"; $const_regexp = "([a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*)"; $template = preg_replace("/([\n\r]+)\t+/s", "\\1", $template); $template = preg_replace("/\\<\\!\\-\\-\\{(.+?)\\}\\-\\-\\>/s", "{\\1}", $template); $template = preg_replace("/\\{lang\\s+(.+?)\\}/ies", "languagevar('\\1')", $template); $template = str_replace("{LF}", "<?=\"\\n\"?>", $template); $template = preg_replace("/\\{(\\\$[a-zA-Z0-9_\\[\\]\\'\"\$\\.-ÿ]+)\\}/s", "<?=\\1?>", $template); $template = preg_replace("/{$var_regexp}/es", "addquote('<?=\\1?>')", $template); $template = preg_replace("/\\<\\?\\=\\<\\?\\={$var_regexp}\\?\\>\\?\\>/es", "addquote('<?=\\1?>')", $template); $template = "<? if(!defined('IN_GAME')) exit('Access Denied'); ?>\n{$template}"; $template = preg_replace("/[\n\r\t]*\\{template\\s+([a-z0-9_]+)\\}[\n\r\t]*/is", "\n<? include template('\\1'); ?>\n", $template); $template = preg_replace("/[\n\r\t]*\\{template\\s+(.+?)\\}[\n\r\t]*/is", "\n<? include template(\\1); ?>\n", $template); $template = preg_replace("/[\n\r\t]*\\{eval\\s+(.+?)\\}[\n\r\t]*/ies", "stripvtags('\n<? \\1 ?>\n','')", $template); $template = preg_replace("/[\n\r\t]*\\{echo\\s+(.+?)\\}[\n\r\t]*/ies", "stripvtags('\n<? echo \\1; ?>\n','')", $template); $template = preg_replace("/[\n\r\t]*\\{elseif\\s+(.+?)\\}[\n\r\t]*/ies", "stripvtags('\n<? } elseif(\\1) { ?>\n','')", $template); $template = preg_replace("/[\n\r\t]*\\{else\\}[\n\r\t]*/is", "\n<? } else { ?>\n", $template); for ($i = 0; $i < $nest; $i++) { $template = preg_replace("/[\n\r\t]*\\{loop\\s+(\\S+)\\s+(\\S+)\\}[\n\r]*(.+?)[\n\r]*\\{\\/loop\\}[\n\r\t]*/ies", "stripvtags('\n<? if(is_array(\\1)) { foreach(\\1 as \\2) { ?>','\n\\3\n<? } } ?>\n')", $template); $template = preg_replace("/[\n\r\t]*\\{loop\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\}[\n\r\t]*(.+?)[\n\r\t]*\\{\\/loop\\}[\n\r\t]*/ies", "stripvtags('\n<? if(is_array(\\1)) { foreach(\\1 as \\2 => \\3) { ?>','\n\\4\n<? } } ?>\n')", $template); $template = preg_replace("/[\n\r\t]*\\{if\\s+(.+?)\\}[\n\r]*(.+?)[\n\r]*\\{\\/if\\}[\n\r\t]*/ies", "stripvtags('\n<? if(\\1) { ?>','\n\\2\n<? } ?>\n')", $template); } $template = preg_replace("/\\{{$const_regexp}\\}/s", "<?=\\1?>", $template); $template = preg_replace("/ \\?\\>[\n\r]*\\<\\? /s", " ", $template); $template = preg_replace("/\\<\\?/s", "<?php", $template); $template = preg_replace("/\\<\\?php\\=/s", "<?php echo ", $template); if (!($fp = fopen($objfile, 'w'))) { gexit("Directory './gamedata/templates/' not found or have no access!"); } $template = preg_replace("/\"(http)?[\\w\\.\\/:]+\\?[^\"]+?&[^\"]+?\"/e", "transamp('\\0')", $template); flock($fp, 2); fwrite($fp, $template); fclose($fp); }
require './include/common.inc.php'; require './include/user.func.php'; eval(import_module('cardbase')); if (!$cuser || !$cpass) { gexit($_ERROR['no_login'], __FILE__, __LINE__); } $result = $db->query("SELECT * FROM {$gtablepre}users WHERE username='******'"); if (!$db->num_rows($result)) { gexit($_ERROR['login_check'], __FILE__, __LINE__); } $udata = $db->fetch_array($result); if ($udata['password'] != $cpass) { gexit($_ERROR['wrong_pw'], __FILE__, __LINE__); } if ($udata['groupid'] <= 0) { gexit($_ERROR['user_ban'], __FILE__, __LINE__); } if (!isset($mode)) { $mode = 'show'; } if ($mode == 'edit') { $gamedata = array(); $gamedata['innerHTML']['info'] = ''; if ($opass && $npass && $rnpass) { $pass_right = true; $pass_check = pass_check($npass, $rnpass); if ($pass_check != 'pass_ok') { $gamedata['innerHTML']['info'] .= $_ERROR[$pass_check] . '<br />'; $pass_right = false; } $opass = md5($opass);
exit; } $result = $db->query("SELECT * FROM {$tablepre}players WHERE name = '{$cuser}' AND type = 0"); if (!$db->num_rows($result)) { header("Location: valid.php"); exit; } $pdata = $db->fetch_array($result); if ($pdata['pass'] != $cpass) { $tr = $db->query("SELECT `password` FROM {$gtablepre}users WHERE username='******'"); $tp = $db->fetch_array($tr); $password = $tp['password']; if ($password == $cpass) { $db->query("UPDATE {$tablepre}players SET pass='******' WHERE name='{$cuser}'"); } else { gexit($_ERROR['wrong_pw'], __FILE__, __LINE__); } } if ($gamestate == 0) { header("Location: end.php"); exit; } \player\load_playerdata(\player\fetch_playerdata($cuser)); \player\init_playerdata(); \player\init_profile(); $log = ''; //读取聊天信息 $chatdata = getchat(0, $teamID); $hp_backup_temp = $hp; $player_dead_flag_backup_temp = $player_dead_flag; if ($hp <= 0 || $player_dead_flag) {
} $result = $db->query("SELECT * FROM {$gtablepre}users WHERE username='******'"); if (!$db->num_rows($result)) { gexit($_ERROR['login_check'], __FILE__, __LINE__); } $udata = $db->fetch_array($result); if ($udata['password'] != $cpass) { gexit($_ERROR['wrong_pw'], __FILE__, __LINE__); } if ($udata['groupid'] <= 0) { gexit($_ERROR['user_ban'], __FILE__, __LINE__); } extract($udata); $curuser = true; } else { $uname = urldecode($_REQUEST["playerID"]); $result = $db->query("SELECT * FROM {$gtablepre}users WHERE username='******'"); if (!$db->num_rows($result)) { gexit($_ERROR['user_not_exists'], __FILE__, __LINE__); } $udata = $db->fetch_array($result); extract($udata); $curuser = false; if ($uname == $cuser) { $curuser = true; } } $iconarray = get_iconlist($icon); $select_icon = $icon; $winning_rate = $validgames ? round($wingames / $validgames * 100) . "%" : '0%'; include template('user_profile');
include template('notice'); } elseif ($mode == 'tutorial') { if (!isset($tmode)) { $tmode = 0; } $nexttmode = $tmode + 1; include template('tutorial'); } else { extract($udata); $result = $db->query("SELECT * FROM {$tablepre}players WHERE name = '{$cuser}' AND type = 0"); if ($db->num_rows($result)) { header("Location: game.php"); exit; } if ($validnum >= $validlimit) { gexit($_ERROR['player_limit'], __FILE__, __LINE__); } $iconarray = get_iconlist($icon); $select_icon = $icon; include template('valid'); } function makeclub() { global $wp, $wk, $wg, $wc, $wd, $wf, $money, $mhp, $msp, $hp, $sp, $att, $def; $wp = $wk = $wg = $wc = $wd = $wf = 0; $dice = rand(0, 105); if ($dice < 10) { $club = 1; $wp = 30; } elseif ($dice < 20) { $club = 2;
} $kres = $t; } $isnew = array(); foreach ($kres as $key => $val) { if (($ktype == 0 || $ktype == 2) && $choice != $key) { $isnew[$key] = ""; continue; } if (!in_array($val, $oc)) { $isnew[$key] = "<span class=\"L5\">NEW!</span>"; } else { $isnew[$key] = ""; } } $ishighlight = array(); if ($ktype == 0 || $ktype == 2) { for ($i = 1; $i <= 4; $i++) { $ishighlight[$i] = $i == $choice; } } include template('kujiresult'); } else { gexit($_ERROR['kuji_failure'], __FILE__, __LINE__); } } else { //翻卡UI include template('kujipick'); } ?>
<?php define('CURSCRIPT', 'register'); require './include/common.inc.php'; include './include/user.func.php'; include './gamedata/banlist.list'; if (isset($cuser) && isset($cpass)) { gexit($_ERROR['logged_in'], __FILE__, __LINE__); } if (!isset($cmd)) { //$ustate = 'register'; $icon = 0; $gender = 'm'; $iconarray = get_iconlist(); $select_icon = 0; $motto = $criticalmsg = $killmsg = $lastword = ''; include template('register'); } elseif ($cmd = 'post_register') { //$ustate = 'register'; $gamedata = array(); $name_check = name_check($username); $pass_check = pass_check($npass, $rnpass); $onlineip = real_ip(); if ($name_check != 'name_ok') { $gamedata['innerHTML']['info'] = $_ERROR[$name_check]; } elseif ($pass_check != 'pass_ok') { $gamedata['innerHTML']['info'] = $_ERROR[$pass_check]; } elseif (preg_match($iplimit, $onlineip)) { $gamedata['innerHTML']['info'] = $_ERROR['ip_banned']; } else { $result = $db->query("SELECT * FROM {$gtablepre}users WHERE username = '******'");
define('IN_ADMIN', TRUE); require GAME_ROOT . './gamedata/admincfg.php'; require GAME_ROOT . './include/admin/admin.lang.php'; $admin_cmd_list = array('configmng' => 9, 'systemmng' => 7, 'gamecfgmng' => 7, 'gmlist' => 9, 'urlist' => 9, 'banlistmng' => 6, 'gamecheck' => 2, 'pcmng' => 5, 'npcmng' => 5, 'gameinfomng' => 5, 'antiAFKmng' => 4, 'rankclear' => 9, 'roomclose' => 7); if (!$cuser || !$cpass) { gexit($_ERROR['no_login'], __FILE__, __LINE__); } $result = $db->query("SELECT * FROM {$gtablepre}users WHERE username='******'"); if (!$db->num_rows($result)) { gexit($_ERROR['login_check'], __FILE__, __LINE__); } $udata = $db->fetch_array($result); if ($udata['password'] != $cpass) { gexit($_ERROR['wrong_pw'], __FILE__, __LINE__); } elseif ($udata['groupid'] <= 1 && $cuser !== $gamefounder) { gexit($_ERROR['no_admin'], __FILE__, __LINE__); } if ($cuser === $gamefounder) { $mygroup = 10; } else { $mygroup = $udata['groupid']; } $showdata = $cmd_info = false; if ($mode == 'admin_menu' && in_array($command, array_keys($admin_cmd_list))) { //进入子菜单的指令 if ($mygroup >= $admin_cmd_list[$command]) { include_once GAME_ROOT . "./include/admin/{$command}.php"; $showdata = ob_get_contents(); } else { $cmd_info = $_ERROR['no_power']; }
if (@($fp = fopen(GAME_ROOT . './gamedata/dberror.log', 'r'))) { while (!feof($fp) && count($errlog) < 20) { $log = explode("\t", fgets($fp, 50)); if ($timestamp - $log[0] < 86400) { $errlog[$log[0]] = $log[1]; } } fclose($fp); } if (!in_array($dberrno, $errlog)) { $errlog[$timestamp] = $dberrno; @($fp = fopen(GAME_ROOT . './gamedata/dberror.log', 'w')); @flock($fp, 2); foreach (array_unique($errlog) as $dateline => $errno) { @fwrite($fp, "{$dateline}\t{$errno}"); } @fclose($fp); if (function_exists('errorlog')) { errorlog('MySQL', basename($GLOBALS['_SERVER']['PHP_SELF']) . " : {$dberror} - " . cutstr($sql, 120), 0); } if ($GLOBALS['dbreport']) { echo "<br><br>An error report has been dispatched to our administrator."; @sendmail($GLOBALS['adminemail'], '[bra!] MySQL Error Report', "There seems to have been a problem with the database of your bra game\n\n" . strip_tags($errmsg) . "\n\n" . "Please check-up your MySQL server and forum scripts, similar errors will not be reported again in recent 24 hours\n" . "If you have troubles in solving this problem, please visit loongyou Community http://www.loongyou.com"); } } else { echo '<br><br>Similar error report has beed dispatched to administrator before.'; } } echo '</p>'; function_exists('gexit') ? gexit() : exit; }
} $udata = $db->fetch_array($result); if ($udata['password'] != $cpass) { gexit($_ERROR['wrong_pw'], __FILE__, __LINE__); } if ($udata['groupid'] <= 0) { gexit($_ERROR['user_ban'], __FILE__, __LINE__); } //write card json //$objfile = GAME_ROOT."./gamedata/templates/{$templateid}_$file.tpl.php"; require config('card', $gamecfg); $jfile = GAME_ROOT . "./gamedata/cache/card.json"; $cdfile = GAME_ROOT . "./gamedata/cache/card_1.php"; if (!file_exists($jfile) || filemtime($cdfile) > filemtime($jfile)) { if (!($fp = fopen($jfile, 'w'))) { gexit("咕咕咕"); } $jdesc = json_encode($carddesc, JSON_UNESCAPED_UNICODE); flock($fp, 2); fwrite($fp, $jdesc); fclose($fp); } if (!isset($mode)) { $mode = 'show'; } if ($mode == 'edit') { $gamedata = array(); $gamedata['innerHTML']['info'] = ''; if ($opass && $npass && $rnpass) { $pass_right = true; $pass_check = pass_check($npass, $rnpass);
function rs_game($mode = 0) { global $db, $tablepre, $gamecfg, $now, $gamestate, $plsinfo, $typeinfo, $areanum, $areaadd, $afktime, $combonum, $deathlimit; // $stime=getmicrotime(); $dir = GAME_ROOT . './gamedata/'; $sqldir = GAME_ROOT . './gamedata/sql/'; if ($mode & 1) { //重设玩家互动信息、聊天记录、地图道具、地图陷阱、进行状况 $sql = file_get_contents("{$sqldir}reset.sql"); $sql = str_replace("\r", "\n", str_replace(' bra_', ' ' . $tablepre, $sql)); $db->queries($sql); //重设游戏进行状况的时间 if ($fp = fopen("{$dir}newsinfo.php", 'wb')) { global $checkstr; fwrite($fp, $checkstr); fclose($fp); } else { gexit('Can not write to cache files, please check directory ./gamedata/ and ./gamedata/cache/ .', __FILE__, __LINE__); } //清空战斗信息 global $hdamage, $hplayer, $noisetime, $noisepls, $noiseid, $noiseid2, $noisemode, $starttime, $gamevars; $hdamage = 0; $hplayer = ''; $noisetime = 0; $noisepls = 0; $noiseid = 0; $noiseid2 = 0; $noisemode = ''; save_combatinfo(); //修改反挂机间隔 $afktime = $starttime; //重设连斗判断死亡数 $combonum = $deathlimit; //重设游戏剧情开关 $gamevars = 0; save_gameinfo(); } if ($mode & 2) { //echo " - 禁区初始化 - "; global $arealist, $areanum, $weather, $hack, $areatime, $starttime, $startmin, $areaadd, $areahour; list($sec, $min, $hour, $day, $month, $year, $wday, $yday, $isdst) = localtime($starttime); $areatime = ceil(($starttime + $areahour * 60) / 600) * 600; //$areahour已改为按分钟计算,ceil是为了让禁区分钟为10的倍数 $plsnum = sizeof($plsinfo); $arealist = range(1, $plsnum - 1); shuffle($arealist); array_unshift($arealist, 0); $areanum = 0; $weather = rand(0, 9); $hack = 0; movehtm($areatime); } if ($mode & 4) { //echo " - 角色数据库初始化 - "; global $validnum, $alivenum, $deathnum; $sql = file_get_contents("{$sqldir}players.sql"); $sql = str_replace("\r", "\n", str_replace(' bra_', ' ' . $tablepre, $sql)); $db->queries($sql); //runquery($sql); $validnum = $alivenum = $deathnum = 0; } if ($mode & 8) { //echo " - NPC初始化 - "; $db->query("DELETE FROM {$tablepre}players WHERE type>0 "); include_once config('npc', $gamecfg); //$typenum = sizeof($typeinfo); $plsnum = sizeof($plsinfo); $npcqry = ''; //for($i = 1; $i < $typenum; $i++) { foreach ($npcinfo as $i => $npcs) { if (!empty($npcs)) { if (sizeof($npcs['sub']) > $npcs['num']) { shuffle($npcs['sub']); } for ($j = 1; $j <= $npcs['num']; $j++) { $npc = array_merge($npcinit, $npcs); //$npc = $npcinfo[$i]; $npc['type'] = $i; $npc['endtime'] = $now; $npc['sNo'] = $j; //if(($npc['mode'] == 1)&&($npc['num'] <= $npc['sub'])){ // $npc = array_merge($npc,$npc[$j]); //} elseif($npc['mode'] == 2) { // $k = rand(1,$npc['sub']); // $npc = array_merge($npc,$npc[$k]); //} else { // $npc = array_merge($npc,$npc[1]); //} $subnum = sizeof($npc['sub']); $sub = $j % $subnum; $npc = array_merge($npc, $npc['sub'][$sub]); $npc['hp'] = $npc['mhp']; $npc['sp'] = $npc['msp']; $npc['exp'] = round(2 * $npc['lvl'] * $GLOBALS['baseexp']); foreach (array('p', 'k', 'g', 'c', 'd', 'f') as $val) { if (!$npc['w' . $val]) { $npc['w' . $val] = $npc['skill']; } } //$npc['wp'] = $npc['wk'] = $npc['wg'] = $npc['wc'] = $npc['wd'] = $npc['wf'] = $npc['skill']; if ($npc['gd'] == 'r') { $npc['gd'] = rand(0, 1) ? 'm' : 'f'; } do { $rpls = rand(1, $plsnum - 1); } while ($rpls == 34); if ($npc['pls'] == 99) { $npc['pls'] = $rpls; } $npc['state'] = 0; $npcqry .= "('" . $npc['name'] . "','" . $npc['pass'] . "','" . $npc['type'] . "','" . $npc['endtime'] . "','" . $npc['gd'] . "','" . $npc['sNo'] . "','" . $npc['icon'] . "','" . $npc['club'] . "','" . $npc['rp'] . "','" . $npc['hp'] . "','" . $npc['mhp'] . "','" . $npc['sp'] . "','" . $npc['msp'] . "','" . $npc['att'] . "','" . $npc['def'] . "','" . $npc['pls'] . "','" . $npc['lvl'] . "','" . $npc['exp'] . "','" . $npc['money'] . "','" . $npc['bid'] . "','" . $npc['inf'] . "','" . $npc['rage'] . "','" . $npc['pose'] . "','" . $npc['tactic'] . "','" . $npc['killnum'] . "','" . $npc['state'] . "','" . $npc['wp'] . "','" . $npc['wk'] . "','" . $npc['wg'] . "','" . $npc['wc'] . "','" . $npc['wd'] . "','" . $npc['wf'] . "','" . $npc['teamID'] . "','" . $npc['teamPass'] . "','" . $npc['wep'] . "','" . $npc['wepk'] . "','" . $npc['wepe'] . "','" . $npc['weps'] . "','" . $npc['arb'] . "','" . $npc['arbk'] . "','" . $npc['arbe'] . "','" . $npc['arbs'] . "','" . $npc['arh'] . "','" . $npc['arhk'] . "','" . $npc['arhe'] . "','" . $npc['arhs'] . "','" . $npc['ara'] . "','" . $npc['arak'] . "','" . $npc['arae'] . "','" . $npc['aras'] . "','" . $npc['arf'] . "','" . $npc['arfk'] . "','" . $npc['arfe'] . "','" . $npc['arfs'] . "','" . $npc['art'] . "','" . $npc['artk'] . "','" . $npc['arte'] . "','" . $npc['arts'] . "','" . $npc['itm0'] . "','" . $npc['itmk0'] . "','" . $npc['itme0'] . "','" . $npc['itms0'] . "','" . $npc['itm1'] . "','" . $npc['itmk1'] . "','" . $npc['itme1'] . "','" . $npc['itms1'] . "','" . $npc['itm2'] . "','" . $npc['itmk2'] . "','" . $npc['itme2'] . "','" . $npc['itms2'] . "','" . $npc['itm3'] . "','" . $npc['itmk3'] . "','" . $npc['itme3'] . "','" . $npc['itms3'] . "','" . $npc['itm4'] . "','" . $npc['itmk4'] . "','" . $npc['itme4'] . "','" . $npc['itms4'] . "','" . $npc['itm5'] . "','" . $npc['itmk5'] . "','" . $npc['itme5'] . "','" . $npc['itms5'] . "','" . $npc['itm6'] . "','" . $npc['itmk6'] . "','" . $npc['itme6'] . "','" . $npc['itms6'] . "','" . $npc['wepsk'] . "','" . $npc['arbsk'] . "','" . $npc['arhsk'] . "','" . $npc['arask'] . "','" . $npc['arfsk'] . "','" . $npc['artsk'] . "','" . $npc['itmsk0'] . "','" . $npc['itmsk1'] . "','" . $npc['itmsk2'] . "','" . $npc['itmsk3'] . "','" . $npc['itmsk4'] . "','" . $npc['itmsk5'] . "','" . $npc['itmsk6'] . "','" . $npc['skills'] . "'),"; //$db->query("INSERT INTO {$tablepre}players (name,pass,type,endtime,gd,sNo,icon,club,hp,mhp,sp,msp,att,def,pls,lvl,`exp`,money,bid,inf,rage,pose,tactic,killnum,state,wp,wk,wg,wc,wd,wf,teamID,teamPass,wep,wepk,wepe,weps,arb,arbk,arbe,arbs,arh,arhk,arhe,arhs,ara,arak,arae,aras,arf,arfk,arfe,arfs,art,artk,arte,arts,itm0,itmk0,itme0,itms0,itm1,itmk1,itme1,itms1,itm2,itmk2,itme2,itms2,itm3,itmk3,itme3,itms3,itm4,itmk4,itme4,itms4,itm5,itmk5,itme5,itms5,wepsk,arbsk,arhsk,arask,arfsk,artsk,itmsk0,itmsk1,itmsk2,itmsk3,itmsk4,itmsk5) VALUES ('".$npc['name']."','".$npc['pass']."','".$npc['type']."','".$npc['endtime']."','".$npc['gd']."','".$npc['sNo']."','".$npc['icon']."','".$npc['club']."','".$npc['hp']."','".$npc['mhp']."','".$npc['sp']."','".$npc['msp']."','".$npc['att']."','".$npc['def']."','".$npc['pls']."','".$npc['lvl']."','".$npc['exp']."','".$npc['money']."','".$npc['bid']."','".$npc['inf']."','".$npc['rage']."','".$npc['pose']."','".$npc['tactic']."','".$npc['killnum']."','".$npc['death']."','".$npc['wp']."','".$npc['wk']."','".$npc['wg']."','".$npc['wc']."','".$npc['wd']."','".$npc['wf']."','".$npc['teamID']."','".$npc['teamPass']."','".$npc['wep']."','".$npc['wepk']."','".$npc['wepe']."','".$npc['weps']."','".$npc['arb']."','".$npc['arbk']."','".$npc['arbe']."','".$npc['arbs']."','".$npc['arh']."','".$npc['arhk']."','".$npc['arhe']."','".$npc['arhs']."','".$npc['ara']."','".$npc['arak']."','".$npc['arae']."','".$npc['aras']."','".$npc['arf']."','".$npc['arfk']."','".$npc['arfe']."','".$npc['arfs']."','".$npc['art']."','".$npc['artk']."','".$npc['arte']."','".$npc['arts']."','".$npc['itm0']."','".$npc['itmk0']."','".$npc['itme0']."','".$npc['itms0']."','".$npc['itm1']."','".$npc['itmk1']."','".$npc['itme1']."','".$npc['itms1']."','".$npc['itm2']."','".$npc['itmk2']."','".$npc['itme2']."','".$npc['itms2']."','".$npc['itm3']."','".$npc['itmk3']."','".$npc['itme3']."','".$npc['itms3']."','".$npc['itm4']."','".$npc['itmk4']."','".$npc['itme4']."','".$npc['itms4']."','".$npc['itm5']."','".$npc['itmk5']."','".$npc['itme5']."','".$npc['itms5']."','".$npc['wepsk']."','".$npc['arbsk']."','".$npc['arhsk']."','".$npc['arask']."','".$npc['arfsk']."','".$npc['artsk']."','".$npc['itmsk0']."','".$npc['itmsk1']."','".$npc['itmsk2']."','".$npc['itmsk3']."','".$npc['itmsk4']."','".$npc['itmsk5']."')"); unset($npc); } } } if (!empty($npcqry)) { $npcqry = "INSERT INTO {$tablepre}players (name,pass,type,endtime,gd,sNo,icon,club,rp,hp,mhp,sp,msp,att,def,pls,lvl,`exp`,money,bid,inf,rage,pose,tactic,killnum,state,wp,wk,wg,wc,wd,wf,teamID,teamPass,wep,wepk,wepe,weps,arb,arbk,arbe,arbs,arh,arhk,arhe,arhs,ara,arak,arae,aras,arf,arfk,arfe,arfs,art,artk,arte,arts,itm0,itmk0,itme0,itms0,itm1,itmk1,itme1,itms1,itm2,itmk2,itme2,itms2,itm3,itmk3,itme3,itms3,itm4,itmk4,itme4,itms4,itm5,itmk5,itme5,itms5,itm6,itmk6,itme6,itms6,wepsk,arbsk,arhsk,arask,arfsk,artsk,itmsk0,itmsk1,itmsk2,itmsk3,itmsk4,itmsk5,itmsk6,skills) VALUES " . substr($npcqry, 0, -1); $db->query($npcqry); unset($npcqry); } } if ($mode & 16) { //echo " - 地图道具/陷阱初始化 - "; //感谢 Martin1994 提供地图道具数据库化的源代码 $plsnum = sizeof($plsinfo); $iqry = $tqry = ''; // if($gamestate == 0){ // global $checkstr; // dir_clear("{$dir}mapitem/"); // for($i = 0;$i < $plsnum; $i++){ // $mapfile = GAME_ROOT."./gamedata/mapitem/{$i}mapitem.php"; // writeover($mapfile,$checkstr); // } // } $file = config('mapitem', $gamecfg); $itemlist = openfile($file); $in = sizeof($itemlist); $an = $areanum ? ceil($areanum / $areaadd) : 0; //$mapitem = array(); //$ifqry = $iqry = 'INSERT INTO '.$tablepre.'mapitem (itm,itmk,itme,itms,itmsk,map) VALUES '; for ($i = 1; $i < $in; $i++) { if (!empty($itemlist[$i]) && strpos($itemlist[$i], ',') !== false) { list($iarea, $imap, $inum, $iname, $ikind, $ieff, $ista, $iskind) = explode(',', $itemlist[$i]); if ($iarea == $an || $iarea == 99) { for ($j = $inum; $j > 0; $j--) { if ($imap == 99) { $rmap = rand(1, $plsnum - 1); while ($rmap == 34) { $rmap = rand(1, $plsnum - 1); } if (strpos($ikind, 'TO') === 0) { $tqry .= "('{$iname}', '{$ikind}','{$ieff}','{$ista}','{$iskind}','{$rmap}'),"; } else { $iqry .= "('{$iname}', '{$ikind}','{$ieff}','{$ista}','{$iskind}','{$rmap}'),"; } //$iqry[$rmap] .= "('$iname', '$ikind','$ieff','$ista','$iskind'),"; //$db->query("INSERT INTO {$tablepre}{$rmap}mapitem (itm,itmk,itme,itms,itmsk) VALUES ('$iname', '$ikind','$ieff','$ista','$iskind')"); } else { if (strpos($ikind, 'TO') === 0) { $tqry .= "('{$iname}', '{$ikind}','{$ieff}','{$ista}','{$iskind}','{$imap}'),"; } else { $iqry .= "('{$iname}', '{$ikind}','{$ieff}','{$ista}','{$iskind}','{$imap}'),"; } //$db->query("INSERT INTO {$tablepre}{$imap}mapitem (itm,itmk,itme,itms,itmsk) VALUES ('$iname', '$ikind','$ieff','$ista','$iskind')"); } //if($imap == 99) { // $imap = rand(1,$plsnum-1); //$mapitem[$rmap] .= "$iname,$ikind,$ieff,$ista,$iskind,\n"; //} else { //$mapitem[$imap] .= "$iname,$ikind,$ieff,$ista,$iskind,\n"; //} } } } } if (!empty($iqry)) { $iqry = "INSERT INTO {$tablepre}mapitem (itm,itmk,itme,itms,itmsk,pls) VALUES " . substr($iqry, 0, -1); $db->query($iqry); } if (!empty($tqry)) { $tqry = "INSERT INTO {$tablepre}maptrap (itm,itmk,itme,itms,itmsk,pls) VALUES " . substr($tqry, 0, -1); $db->query($tqry); } // for($imap = 0;$imap<$plsnum;$imap++){ // if(!empty($iqry[$imap])){ // $iqry[$imap] = "INSERT INTO {$tablepre}{$imap}mapitem (itm,itmk,itme,itms,itmsk) VALUES ".substr($iqry[$imap], 0, -1); // $db->query($iqry[$imap]); // } // } // if($ifqry != $iqry){//判定是否有数据写入 // $iqry = substr($iqry, 0, -1);//去除尾部多余的逗号 // $db->query($iqry); // } // foreach($mapitem as $map => $itemdata) { // $mapfile = GAME_ROOT."./gamedata/mapitem/{$map}mapitem.php"; // writeover($mapfile,$itemdata,'ab'); // } unset($itemlist); unset($iqry); //unset($mapitem); } if ($mode & 32) { //echo " - 商店初始化 - "; $sql = file_get_contents("{$sqldir}shopitem.sql"); $sql = str_replace("\r", "\n", str_replace(' bra_', ' ' . $tablepre, $sql)); $db->queries($sql); //runquery($sql); $file = config('shopitem', $gamecfg); $shoplist = openfile($file); $qry = ''; foreach ($shoplist as $lst) { if (!empty($lst) && strpos($lst, ',') !== false) { list($kind, $num, $price, $area, $item, $itmk, $itme, $itms, $itmsk) = explode(',', $lst); if ($kind != 0) { $qry .= "('{$kind}','{$num}','{$price}','{$area}','{$item}','{$itmk}','{$itme}','{$itms}','{$itmsk}'),"; } } } if (!empty($qry)) { $qry = "INSERT INTO {$tablepre}shopitem (kind,num,price,area,item,itmk,itme,itms,itmsk) VALUES " . substr($qry, 0, -1); } $db->query($qry); } }
if (!$cuser || !$cpass) { gexit($_ERROR['no_login'], __FILE__, __LINE__); } $result = $db->query("SELECT * FROM {$gtablepre}users WHERE username='******'"); if (!$db->num_rows($result)) { gexit($_ERROR['login_check'], __FILE__, __LINE__); } $udata = $db->fetch_array($result); if ($udata['password'] != $cpass) { gexit($_ERROR['wrong_pw'], __FILE__, __LINE__); } if ($udata['groupid'] <= 0) { gexit($_ERROR['user_ban'], __FILE__, __LINE__); } if ($udata['gold'] < 100) { gexit($_ERROR['not_enough_gold'], __FILE__, __LINE__); } extract($udata); if ($udata['cardlist'] == "") { $udata['cardlist'] = "0"; } require config('card', $gamecfg); //weight $sw = 1; $aw = 6; $bw = 26; $cw = 100; $r = rand(1, $cw); if ($r <= $sw) { $arr = $cardindex['S']; } else {
if ($udata['roomid'] == '' || $udata['roomid'][0] != 's') { gexit('你不在一个房间内。'); } $roomid = substr($udata['roomid'], 1); ignore_user_abort(1); $_POST = gstrfilter($_POST); if (!file_exists(GAME_ROOT . './gamedata/tmp/rooms/' . $roomid . '.txt')) { gexit('房间不存在。'); } $result = $db->query("SELECT * FROM {$gtablepre}rooms WHERE roomid='{$roomid}'"); if (!$db->num_rows($result)) { gexit('房间不存在。'); } $zz = $db->fetch_array($result); if ($zz['status'] == 0) { gexit('房间不存在。'); } if ($zz['status'] == 2) { ob_clean(); $gamedata['url'] = 'game.php'; echo base64_encode(gzencode(compatible_json_encode($gamedata))); die; } $roomdata = json_decode(mgzdecode(base64_decode(file_get_contents(GAME_ROOT . './gamedata/tmp/rooms/' . $roomid . '.txt'))), 1); //载入气泡框模块和发光按钮模块 require GAME_ROOT . './include/modules/extra/misc/bubblebox/module.inc.php'; require GAME_ROOT . './include/modules/extra/misc/glowbutton/module.inc.php'; $timestamp = (int) $_POST['timestamp']; if ($timestamp < $roomdata['timestamp']) { room_showdata($roomdata, $cuser); die;
<?php define('CURSCRIPT', 'user_profile'); require './include/common.inc.php'; if ($cuser == '') { gexit('请登录'); die; } \achievement_base\show_achievements();
function save_combatinfo() { global $hdamage, $hplayer, $noisetime, $noisepls, $noiseid, $noiseid2, $noisemode; if (!$hdamage) { $hdamage = 0; } if (!$noisetime) { $noisetime = 0; } if (!$noisepls) { $noisepls = 0; } if (!$noiseid) { $noiseid = 0; } if (!$noiseid2) { $noiseid2 = 0; } $combatinfo = "<?php\n\nif(!defined('IN_GAME')){exit('Access Denied');}\n\n\$hdamage = {$hdamage};\n\$hplayer = '{$hplayer}';\n\$noisetime = {$noisetime};\n\$noisepls = {$noisepls};\n\$noiseid = {$noiseid};\n\$noiseid2 = {$noiseid2};\n\$noisemode = '{$noisemode}';\n\n?>"; //$combatinfo = "{$hdamage},{$hplayer},{$noisetime},{$noisepls},{$noiseid},{$noiseid2},{$noisemode},\n"; $dir = GAME_ROOT . './gamedata/'; if ($fp = fopen("{$dir}combatinfo.php", 'w')) { if (flock($fp, LOCK_EX)) { fwrite($fp, $combatinfo); } else { exit("Couldn't save combat info !"); } fclose($fp); } else { gexit('Can not write to cache files, please check directory ./gamedata/ .', __FILE__, __LINE__); } return; }
$count = $db->result($result, 0); if ($ranklimit < 1) { $ranklimit = 1; } $ostart = -1; if (!isset($command) || !isset($start) || $start < 0) { $ostart = $start = 0; } elseif ($command == 'last') { $ostart = $start; $start -= $ranklimit; } elseif ($command == 'next') { $ostart = $start; $start += $ranklimit; } if ($count == 0) { gexit('No data!'); } if ($start < 0) { $start = 0; } elseif ($start + $ranklimit > $count) { if ($count - $ranklimit >= 0) { $start = $count - $ranklimit; } else { $start = 0; } } //elseif($start + $ranklimit > $count){$ranklimit = $count - $start;} $startnum = $start + 1; if ($start + $ranklimit > $count) { $endnum = $count; } else {
function room_enter($id) { eval(import_module('sys')); $id = (int) $id; $result = $db->query("SELECT status FROM {$gtablepre}rooms WHERE roomid = '{$id}'"); if (!$db->num_rows($result)) { gexit('房间编号不存在', __FILE__, __LINE__); die; } $zz = $db->fetch_array($result); if ($zz['status'] == 0) { gexit('房间编号不存在', __FILE__, __LINE__); die; } if (!file_exists(GAME_ROOT . './gamedata/tmp/rooms/' . $id . '.txt')) { gexit('房间编号不存在', __FILE__, __LINE__); die; } $roomdata = json_decode(mgzdecode(base64_decode(file_get_contents(GAME_ROOT . './gamedata/tmp/rooms/' . $id . '.txt'))), 1); global $cuser; room_new_chat($roomdata, "<span class=\"grey\">{$cuser}进入了房间</span><br>"); $db->query("UPDATE {$gtablepre}users SET roomid = 's{$id}' WHERE username = '******'"); room_save_broadcast($id, $roomdata); header('Location: index.php'); die; }