3 error_reporting(E_ERROR | E_WARNING | E_PARSE);
4 set_magic_quotes_runtime(0);
7 define(
'IN_GAME', TRUE);
8 define(
'GAME_ROOT',
'');
10 if(PHP_VERSION <
'4.3.0') {
11 exit(
'PHP version must >= 4.3.0!');
14 $action = $_POST[
'action'] ? $_POST[
'action'] : $_GET[
'action'];
15 $language = $_POST[
'language'] ? $_POST[
'language'] : $_GET[
'language'];
17 @set_time_limit(1000);
18 @include
'./config.inc.php';
21 case 'simplified_chinese_gbk':
24 case 'simplified_chinese_utf8':
28 case 'traditional_chinese_big5':
31 case 'traditional_chinese_utf8':
47 $languagefile =
'./install/'.$language.
'.lang.php';
48 $sqlfile =
'./install/bra.sql';
49 if(!is_readable($languagefile) || !is_readable($sqlfile)) {
50 exit(
'Please upload ./install and all its files completely.');
53 require_once $languagefile;
55 $lockfile =
'./gamedata/install.lock';
56 if(file_exists($lockfile)) {
57 exit(
$lang[
'lock_exists']);
60 $fp = fopen($sqlfile,
'rb');
61 $sql = fread($fp, 2048000);
65 header(
'Content-Type: text/html; charset='.
$charset);
71 <title>Bra Installation Wizard</title>
73 A:visited {COLOR: #3A4273; TEXT-DECORATION: none}
74 A:link {COLOR: #3A4273; TEXT-DECORATION: none}
75 A:hover {COLOR: #3A4273; TEXT-DECORATION: underline}
76 body,table,td {COLOR: #3A4273; FONT-FAMILY: Tahoma, Verdana, Arial; FONT-SIZE: 12px; LINE-HEIGHT: 20px; scrollbar-base-color: #E3E3EA; scrollbar-arrow-color: #5C5C8D}
77 input {COLOR: #085878; FONT-FAMILY: Tahoma, Verdana, Arial; FONT-SIZE: 12px; background-color: #3A4273; color: #FFFFFF; scrollbar-base-color: #E3E3EA; scrollbar-arrow-color: #5C5C8D}
78 .install {FONT-FAMILY: Arial, Verdana; FONT-SIZE: 20px; FONT-WEIGHT: bold; COLOR: #000000}
83 if(!in_array(
$language, array(
'simplified_chinese_gbk',
'simplified_chinese_utf8',
'traditional_chinese_big5',
'traditional_chinese_utf8',
'english'))) {
86 <body bgcolor=
"#FFFFFF">
87 <table cellpadding=
"0" cellspacing=
"0" border=
"0" width=
"100%" height=
"100%" align=
"center">
88 <tr><td valign=
"middle" align=
"center">
90 <table cellpadding=
"0" cellspacing=
"0" border=
"0" align=
"center">
91 <tr align=
"center" valign=
"middle">
92 <td bgcolor=
"#000000">
93 <table cellpadding=
"10" cellspacing=
"1" border=
"0" width=
"500" height=
"100%" align=
"center">
95 <td valign=
"middle" align=
"center" bgcolor=
"#EBEBEB">
96 <!--
final utf8/orig <br><b>Bra Installation Wizard</b><br><br>Please choose your prefered language<br><br><center><a
href=
"?language=simplified_chinese_gbk">[简体中文 GBK]</a> &
nbsp; <a href=
"?language=simplified_chinese_utf8">[简体中文 UTF-8]</a><br><a href=
"?language=traditional_chinese_big5">[繁體中文 BIG5]</a> &
nbsp; <a href=
"?language=traditional_chinese_utf8">[繁體中文 UTF-8]</a><br><a href=
"?language=english">[English]</a><br><br> -->
97 <br><b>Bra Installation Wizard</b><br><br>Please choose your prefered language<br><br><center> &
nbsp; <a href=
"?language=simplified_chinese_utf8">[简体中文]</a><br> &
nbsp; <a href=
"?language=traditional_chinese_utf8">[繁體中文]</a><br><br>
114 <body bgcolor=
"#3A4273" text=
"#000000">
115 <table width=
"95%" border=
"0" cellspacing=
"0" cellpadding=
"0" bgcolor=
"#FFFFFF" align=
"center">
118 <table width=
"98%" border=
"0" cellspacing=
"0" cellpadding=
"0" align=
"center">
120 <td
class=
"install" height=
"30" valign=
"bottom"><font color=
"#FF0000">>></font>
121 <?php echo
$lang[
'install_wizard']; ?></td>
125 <hr noshade align=
"center" width=
"100%" size=
"1">
130 <b><?php echo $lang[
'welcome']; ?></b>
135 <hr noshade align=
"center" width=
"100%" size=
"1">
142 $discuz_license = str_replace(
' ',
' ',
$lang[
'license']);
146 <td><b><?php echo
$lang[
'current_process']; ?> </b><font color=
"#0000EE"><?php echo $lang[
'show_license']; ?></font></td>
150 <hr noshade align=
"center" width=
"100%" size=
"1">
154 <td><b><font color=
"#FF0000">></font><font color=
"#000000"> <?php echo $lang[
'agreement']; ?></font></b></td>
158 <table width=
"90%" cellspacing=
"1" bgcolor=
"#000000" border=
"0" align=
"center">
160 <td bgcolor=
"#E3E3EA">
161 <table width=
"99%" cellspacing=
"1" border=
"0" align=
"center">
164 <?php echo $discuz_license; ?>
176 <form method=
"post" action=
"?language=<?php echo $language; ?>">
177 <input type=
"hidden" name=
"action" value=
"config">
178 <input type=
"submit" name=
"submit" value=
"<?php echo $lang['agreement_yes']; ?>" style=
"height: 25">&
nbsp;
179 <input type=
"button" name=
"exit" value=
"<?php echo $lang['agreement_no']; ?>" style=
"height: 25" onclick=
"javascript: window.close();">
186 $exist_error = FALSE;
187 $write_error = FALSE;
188 if(file_exists(
'./config.inc.php')) {
189 $fileexists =
result(1, 0);
191 $fileexists =
result(0, 0);
193 $config_info =
$lang[
'config_nonexistence'];
195 if(is_writeable(
'./config.inc.php')) {
196 $filewriteable =
result(1, 0);
197 $config_info =
$lang[
'config_comment'];
199 $filewriteable =
result(0, 0);
201 $config_info =
$lang[
'config_unwriteable'];
206 <td><b><?php echo
$lang[
'current_process']; ?> </b><font color=
"#0000EE"><?php echo $lang[
'configure']; ?></font></td>
210 <hr noshade align=
"center" width=
"100%" size=
"1">
214 <td><b><font color=
"#FF0000">></font><font color=
"#000000"> <?php echo $lang[
'check_config']; ?></font></b></td>
217 <td>
config.inc.php <?php echo $lang[
'check_existence']; ?> <?php echo $fileexists; ?></td>
220 <td>
config.inc.php <?php echo $lang[
'check_writeable']; ?> <?php echo $filewriteable; ?></td>
224 <hr noshade align=
"center" width=
"100%" size=
"1">
228 <td><b><font color=
"#FF0000">></font><font color=
"#000000"> <?php echo $lang[
'edit_config']; ?></font></b></td>
231 <td align=
"center"><br><?php echo $config_info; ?></td>
248 @include
'./config.inc.php';
250 list($nowsec,$nowmin,$nowhour,$nowday,
$nowmonth,
$nowyear,$nowwday,$nowyday,$nowisdst) = localtime(
$now);
259 <form method=
"post" action=
"?language=<?php echo $language; ?>">
260 <table width=
"650" cellspacing=
"1" bgcolor=
"#000000" border=
"0" align=
"center">
261 <tr bgcolor=
"#3A4273">
262 <td align=
"center" width=
"20%" style=
"color: #FFFFFF"><?php echo $lang[
'variable']; ?></td>
263 <td align=
"center" width=
"40%" style=
"color: #FFFFFF"><?php echo $lang[
'value']; ?></td>
264 <td align=
"center" width=
"40%" style=
"color: #FFFFFF"><?php echo $lang[
'comment']; ?></td>
267 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'gamefounder']; ?></td>
268 <td bgcolor=
"#EEEEF6" align=
"center"><input type=
"text" name=
"gamefounder" value=
"<?php echo $gamefounder; ?>" size=
"30"></td>
269 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'gamefounder_comment']; ?></td>
272 <td bgcolor=
"#E3E3EA" style=
"color: #FF0000">&
nbsp;<?php echo $lang[
'dbhost']; ?></td>
273 <td bgcolor=
"#EEEEF6" align=
"center"><input type=
"text" name=
"dbhost" value=
"<?php echo $dbhost; ?>" size=
"30"></td>
274 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'dbhost_comment']; ?></td>
277 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'dbuser']; ?></td>
278 <td bgcolor=
"#EEEEF6" align=
"center"><input type=
"text" name=
"dbuser" value=
"<?php echo $dbuser; ?>" size=
"30"></td>
279 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'dbuser_comment']; ?></td>
282 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'dbpw']; ?></td>
283 <td bgcolor=
"#EEEEF6" align=
"center"><input type=
"password" name=
"dbpw" value=
"<?php echo $dbpw; ?>" size=
"30"></td>
284 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'dbpw_comment']; ?></td>
287 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'moveut']; ?></td>
288 <td bgcolor=
"#EEEEF6" align=
"center"><input type=
"text" name=
"moveut" value=
"<?php echo $moveut; ?>" size=
"30"></td>
289 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'moveut_comment']; ?><br><?php echo
$nowyear; ?><?php echo $lang[
'year']; ?><?php echo
$nowmonth; ?><?php echo $lang[
'month']; ?><?php echo $nowday; ?><?php echo $lang[
'day']; ?><?php echo $nowhour; ?><?php echo $lang[
'hour']; ?><?php echo $nowmin; ?><?php echo $lang[
'min']; ?></td>
292 <td bgcolor=
"#E3E3EA" style=
"color: #FF0000">&
nbsp;<?php echo $lang[
'tablepre']; ?></td>
293 <td bgcolor=
"#EEEEF6" align=
"center"><input type=
"text" name=
"tablepre" value=
"<?php echo $tablepre; ?>" size=
"30" onClick=
"javascript: alert('<?php echo $lang['install_note']; ?>:\n\n<?php echo $lang['tablepre_prompt']; ?>');"></td>
294 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'tablepre_comment']; ?></td>
298 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'authkey']; ?></td>
299 <td bgcolor=
"#EEEEF6" align=
"center"><input type=
"text" name=
"authkey" value=
"<?php echo $authkey; ?>" size=
"30"></td>
300 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'authkey_comment']; ?></td>
303 <input type=
"hidden" name=
"authkey" value=
"<?php echo $authkey; ?>">
305 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'bbsurl']; ?></td>
306 <td bgcolor=
"#EEEEF6" align=
"center"><input type=
"text" name=
"bbsurl" value=
"<?php echo $bbsurl; ?>" size=
"30"></td>
307 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'bbsurl_comment']; ?></td>
310 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'gameurl']; ?></td>
311 <td bgcolor=
"#EEEEF6" align=
"center"><input type=
"text" name=
"gameurl" value=
"<?php echo $gameurl; ?>" size=
"30"></td>
312 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'gameurl_comment']; ?></td>
316 <input type=
"hidden" name=
"action" value=
"dbselect">
317 <input type=
"hidden" name=
"saveconfig" value=
"1">
318 <input type=
"submit" name=
"submit" value=
"<?php echo $lang['save_config']; ?>" style=
"height: 25">
319 <input type=
"button" name=
"exit" value=
"<?php echo $lang['exit']; ?>" style=
"height: 25" onclick=
"javascript: window.close();">
327 @include
'./config.inc.php';
329 list($nowsec,$nowmin,$nowhour,$nowday,
$nowmonth,
$nowyear,$nowwday,$nowyday,$nowisdst) = localtime(
$now);
337 <table width=
"60%" cellspacing=
"1" bgcolor=
"#000000" border=
"0" align=
"center">
338 <tr bgcolor=
"#3A4273">
339 <td align=
"center" style=
"color: #FFFFFF"><?php echo $lang[
'variable']; ?></td>
340 <td align=
"center" style=
"color: #FFFFFF"><?php echo $lang[
'value']; ?></td>
341 <td align=
"center" style=
"color: #FFFFFF"><?php echo $lang[
'comment']; ?></td>
345 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo
$gamefounder; ?></td>
346 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'gamefounder_comment']; ?></td>
349 <td bgcolor=
"#E3E3EA" align=
"center">
$dbhost</td>
350 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo
$dbhost; ?></td>
351 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'dbhost_comment']; ?></td>
354 <td bgcolor=
"#E3E3EA" align=
"center">
$dbuser</td>
355 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo
$dbuser; ?></td>
356 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'dbuser_comment']; ?></td>
359 <td bgcolor=
"#E3E3EA" align=
"center">
$dbpw</td>
360 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo
$dbpw; ?></td>
361 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'dbpw_comment']; ?></td>
364 <td bgcolor=
"#E3E3EA" align=
"center">
$dbname</td>
365 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo
$dbname; ?></td>
366 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'dbname_comment']; ?></td>
369 <td bgcolor=
"#E3E3EA" align=
"center">
$moveut</td>
370 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo
$moveut; ?></td>
371 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'moveut_comment']; ?><br><?php echo
$nowyear; ?><?php echo $lang[
'year']; ?><?php echo
$nowmonth; ?><?php echo $lang[
'month']; ?><?php echo $nowday; ?><?php echo $lang[
'day']; ?><?php echo $nowhour; ?><?php echo $lang[
'hour']; ?><?php echo $nowmin; ?><?php echo $lang[
'min']; ?></td>
374 <td bgcolor=
"#E3E3EA" align=
"center">
$tablepre</td>
375 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo
$tablepre; ?></td>
376 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'tablepre_comment']; ?></td>
380 <td bgcolor=
"#E3E3EA" align=
"center">
$authkey</td>
381 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo
$authkey; ?></td>
382 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'authkey_comment']; ?></td>
385 <input type=
"hidden" name=
"authkey" value=
"<?php echo $authkey; ?>">
387 <td bgcolor=
"#E3E3EA" align=
"center">
$bbsurl</td>
388 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo
$bbsurl; ?></td>
389 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'bbsurl_comment']; ?></td>
392 <td bgcolor=
"#E3E3EA" align=
"center">
$gameurl</td>
393 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo
$gameurl; ?></td>
394 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'gameurl_comment']; ?></td>
402 <form method=
"post" action=
"?language=<?php echo $language; ?>">
403 <input type=
"hidden" name=
"action" value=
"environment">
404 <input type=
"submit" name=
"submit" value=
"<?php echo $lang['confirm_config']; ?>" style=
"height: 25">
405 <input type=
"button" name=
"exit" value=
"<?php echo $lang['refresh_config']; ?>" style=
"height: 25" onclick=
"javascript: window.location=('?language=<?php echo $language; ?>&action=config');">
419 <form method=
"post" action=
"?language=<?php echo $language; ?>">
420 <input type=
"hidden" name=
"action" value=
"config">
421 <input type=
"submit" name=
"submit" value=
"<?php echo $lang['recheck_config']; ?>" style=
"height: 25">
422 <input type=
"button" name=
"exit" value=
"<?php echo $lang['exit']; ?>" style=
"height: 25" onclick=
"javascript: window.close();">
430 $exist_error = FALSE;
431 $write_error = FALSE;
432 if(file_exists(
'./config.inc.php')) {
433 $fileexists =
result(1, 0);
435 $fileexists =
result(0, 0);
437 $config_info = $lang[
'config_nonexistence'];
439 if(is_writeable(
'./config.inc.php')) {
440 $filewriteable =
result(1, 0);
441 $config_info = $lang[
'choice_or_new_db'];
443 $filewriteable =
result(0, 0);
445 $config_info = $lang[
'config_unwriteable'];
449 <td><b><?php echo $lang[
'current_process']; ?> </b><font color=
"#0000EE"><?php echo $lang[
'game_db_conf']; ?></font></td>
453 <hr noshade align=
"center" width=
"100%" size=
"1">
457 <td><b><font color=
"#FF0000">></font><font color=
"#000000"> <?php echo $lang[
'check_config']; ?></font></b></td>
460 <td>
config.inc.php <?php echo $lang[
'check_existence']; ?> <?php echo $fileexists; ?></td>
463 <td>
config.inc.php <?php echo $lang[
'check_writeable']; ?> <?php echo $filewriteable; ?></td>
467 <hr noshade align=
"center" width=
"100%" size=
"1">
471 <td><b><font color=
"#FF0000">></font><font color=
"#000000"><?php echo $lang[
'show_and_edit_db_conf']; ?></font></b></td>
474 <td align=
"center"><br><?php echo $config_info; ?></td>
479 <form method=
"post" action=
"?language=<?php echo $language; ?>">
480 <table width=
"40%" cellspacing=
"1" bgcolor=
"#000000" border=
"0" align=
"center">
481 <tr bgcolor=
"#3A4273">
482 <td align=
"center" colspan=
"3" style=
"color: #FFFFFF"><?php echo $lang[
'db_set']; ?></td>
489 if($_POST[
'saveconfig'] && is_writeable(
'./config.inc.php')) {
498 $moveut = (int)$_POST[
'moveut'];
500 $fp = fopen(
'./config.inc.php',
'r');
501 $configfile = fread($fp, filesize(
'./config.inc.php'));
504 $configfile = preg_replace(
"/[$]gamefounder\s*\=\s*[\"'].*?[\"'];/is",
"\$gamefounder = '$gamefounder';", $configfile);
505 $configfile = preg_replace(
"/[$]dbhost\s*\=\s*[\"'].*?[\"'];/is",
"\$dbhost = '$dbhost';", $configfile);
506 $configfile = preg_replace(
"/[$]dbuser\s*\=\s*[\"'].*?[\"'];/is",
"\$dbuser = '$dbuser';", $configfile);
507 $configfile = preg_replace(
"/[$]dbpw\s*\=\s*[\"'].*?[\"'];/is",
"\$dbpw = '$dbpw';", $configfile);
508 $configfile = preg_replace(
"/[$]tablepre\s*\=\s*[\"'].*?[\"'];/is",
"\$tablepre = '$tablepre';", $configfile);
509 $configfile = preg_replace(
"/[$]authkey\s*\=\s*[\"'].*?[\"'];/is",
"\$authkey = '$authkey';", $configfile);
510 $configfile = preg_replace(
"/[$]bbsurl\s*\=\s*[\"'].*?[\"'];/is",
"\$bbsurl = '$bbsurl';", $configfile);
511 $configfile = preg_replace(
"/[$]gameurl\s*\=\s*[\"'].*?[\"'];/is",
"\$gameurl = '$gameurl';", $configfile);
512 $configfile = preg_replace(
"/[$]moveut\s*\=\s*-?[0-9]+;/is",
"\$moveut = $moveut;", $configfile);
514 $fp = fopen(
'./config.inc.php',
'w');
515 fwrite($fp, trim($configfile));
519 include
'./config.inc.php';
520 include
'./include/db_'.$database.
'.class.php';
524 $query =
$db->query(
"CREATE DATABASE bra_temp",
'SILENT');
528 $query =
$db->query(
"DROP DATABASE bra_temp",
'SILENT');
529 $createerror = FALSE;
532 $query =
$db->query(
"SHOW DATABASES",
'SILENT');
538 $option .=
'<option value="'.$database[
'Database'].
'"' .($dbname ==
$database[
'Database'] ?
' selected' :
'') .
'>'.
$database[
'Database'].
"</option>";
542 if(!empty($option)) {
545 <td bgcolor=
"#EEEEF6">&
nbsp;
546 <input name=
"type" type=
"radio" value=
"2" checked style=
"background-color:#EEEEF6">
547 <?php echo $lang[
'db_use_existence']; ?>:
549 <td bgcolor=
"#EEEEF6">&
nbsp;
550 <select name=
"dbnameselect" style=
"width:200px"><?php echo $option; ?></select>
559 <td bgcolor=
"#EEEEF6">&
nbsp;
560 <input name=
"type" type=
"radio" value=
"1" style=
"background-color:#EEEEF6"<?php echo ((empty($option)) ?
' checked' :
''); ?>>
561 <?php echo $lang[
'db_create_new']; ?>:
563 <td bgcolor=
"#EEEEF6">&
nbsp;
564 <input type=
"text" name=
"dbname" value=
"<?php echo $dbname; ?>" style=
"width:200px">
569 if($createerror && empty($option)) {
572 <td bgcolor=
"#EEEEF6">&
nbsp;
573 <?php echo $lang[
'choice_one_db']; ?>:
575 <td bgcolor=
"#EEEEF6">&
nbsp;
576 <input type=
"text" name=
"dbname" value=
"<?php echo $dbname; ?>" style=
"width:200px">
587 @include
'./config.inc.php';
590 <td bgcolor=
"#EEEEF6">&
nbsp;
591 <?php echo $lang[
'db']; ?>:
593 <td bgcolor=
"#EEEEF6">&
nbsp;
594 <input type=
"hidden" name=
"dbname" value=
"<?php echo $dbname; ?>"><?php echo
$dbname; ?>
606 <input type=
"hidden" name=
"action" value=
"environment">
607 <input type=
"hidden" name=
"saveconfig" value=
"1">
608 <input type=
"submit" name=
"submit" value=
"<?php echo $lang['save_config']; ?>" style=
"height: 25">
609 <input type=
"button" name=
"exit" value=
"<?php echo $lang['exit']; ?>" style=
"height: 25" onclick=
"javascript: window.close();">
620 <form method=
"post" action=
"?language=<?php echo $language; ?>">
621 <input type=
"hidden" name=
"action" value=
"config">
622 <input type=
"submit" name=
"submit" value=
"<?php echo $lang['recheck_config']; ?>" style=
"height: 25">
623 <input type=
"button" name=
"exit" value=
"<?php echo $lang['exit']; ?>" style=
"height: 25" onclick=
"javascript: window.close();">
632 if($_POST[
'saveconfig'] && is_writeable(
'./config.inc.php')) {
634 $dbname = ($_POST[
'type'] == 1) ? $_POST[
'dbname'] : $_POST[
'dbnameselect'];
637 $fp = fopen(
'./config.inc.php',
'r');
638 $configfile = fread($fp, filesize(
'./config.inc.php'));
641 $configfile = preg_replace(
"/[$]dbname\s*\=\s*[\"'].*?[\"'];/is",
"\$dbname = '$dbname';", $configfile);
643 $fp = fopen(
'./config.inc.php',
'w');
644 fwrite($fp, trim($configfile));
649 include
'./config.inc.php';
650 include
'./include/db_'.$database.
'.class.php';
659 $curr_php_version = PHP_VERSION;
660 if($curr_php_version <
'4.3.0') {
661 $msg .=
"<font color=\"#FF0000\">$lang[php_version_430]</font>\t";
665 if(@ini_get(file_uploads)) {
666 $max_size = @ini_get(upload_max_filesize);
667 $curr_upload_status = $lang[
'attach_enabled'].$max_size;
668 $msg .= $lang[
'attach_enabled_info'].$max_size.
"\t";
670 $curr_upload_status = $lang[
'attach_disabled'];
671 $msg .=
"<font color=\"#FF0000\">$lang[attach_disabled_info]</font>\t";
674 $query =
$db->query(
"SELECT VERSION()");
675 $curr_mysql_version =
$db->result($query, 0);
676 if($curr_mysql_version <
'3.23') {
677 $msg .=
"<font color=\"#FF0000\">$lang[mysql_version_323]</font>\t";
681 $curr_disk_space = intval(diskfreespace(
'.') / (1024 * 1024)).
'M';
684 $curr_tpl_writeable = $lang[
'writeable'];
686 $curr_tpl_writeable = $lang[
'unwriteable'];
687 $msg .=
"<font color=\"#FF0000\">$lang[unwriteable_template]</font>\t";
691 $curr_data_writeable = $lang[
'writeable'];
693 $curr_data_writeable = $lang[
'unwriteable'];
694 $msg .=
"<font color=\"#FF0000\">$lang[unwriteable_gamedata]</font>\t";
698 $msg .=
"<font color=\"#FF0000\">$lang[tablepre_invalid]</font>\t";
704 if(
$db->version() >
'4.1') {
705 $db->query(
"CREATE DATABASE IF NOT EXISTS $dbname DEFAULT CHARACTER SET $dbcharset");
707 $db->query(
"CREATE DATABASE IF NOT EXISTS $dbname");
710 $msg .=
"<font color=\"#FF0000\">$lang[db_invalid]</font>\t";
714 $msg .=
"$lang[db_auto_created]\t";
718 $query =
$db->query(
"CREATE TABLE bra_test (test TINYINT (3) UNSIGNED)",
'SILENT');
720 $dbpriv_createtable =
'<font color="#FF0000">'.$lang[
'no'].
'</font>';
723 $dbpriv_createtable = $lang[
'yes'];
725 $query =
$db->query(
"INSERT INTO bra_test (test) VALUES (1)",
'SILENT');
727 $dbpriv_insert =
'<font color="#FF0000">'.$lang[
'no'].
'</font>';
730 $dbpriv_insert = $lang[
'yes'];
732 $query =
$db->query(
"SELECT * FROM bra_test",
'SILENT');
734 $dbpriv_select =
'<font color="#FF0000">'.$lang[
'no'].
'</font>';
737 $dbpriv_select = $lang[
'yes'];
739 $query =
$db->query(
"UPDATE bra_test SET test='2' WHERE test='1'",
'SILENT');
741 $dbpriv_update =
'<font color="#FF0000">'.$lang[
'no'].
'</font>';
744 $dbpriv_update = $lang[
'yes'];
746 $query =
$db->query(
"DELETE FROM bra_test WHERE test='2'",
'SILENT');
748 $dbpriv_delete =
'<font color="#FF0000">'.$lang[
'no'].
'</font>';
751 $dbpriv_delete = $lang[
'yes'];
753 $query =
$db->query(
"DROP TABLE bra_test",
'SILENT');
755 $dbpriv_droptable =
'<font color="#FF0000">'.$lang[
'no'].
'</font>';
758 $dbpriv_droptable = $lang[
'yes'];
761 $query -
$db->query(
"SELECT COUNT(*) FROM $tablepre".
"users",
'SILENT');
763 $msg .=
"<font color=\"#FF0000\">$lang[db_not_null]</font>\t";
764 $alert =
" onSubmit=\"return confirm('$lang[db_drop_table_confirm]');\"";
770 $msg .=
"<font color=\"#FF0000\">$lang[install_abort]</font>";
772 $msg .= $lang[
'install_process'];
776 <td><b><?php echo $lang[
'current_process']; ?> </b><font color=
"#0000EE"><?php echo $lang[
'check_env']; ?></font></td>
780 <hr noshade align=
"center" width=
"100%" size=
"1">
784 <td><b><font color=
"#FF0000">></font><font color=
"#000000"> <?php echo $lang[
'check_user_and_pass']; ?></font></b></td>
789 <table width=
"50%" cellspacing=
"1" bgcolor=
"#000000" border=
"0" align=
"center">
790 <tr bgcolor=
"#3A4273">
791 <td align=
"center" style=
"color: #FFFFFF"><?php echo $lang[
'permission']; ?></td>
792 <td align=
"center" style=
"color: #FFFFFF"><?php echo $lang[
'status']; ?></td>
795 <td bgcolor=
"#E3E3EA" align=
"center">CREATE TABLE</td>
796 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $dbpriv_createtable; ?></td>
799 <td bgcolor=
"#E3E3EA" align=
"center">INSERT</td>
800 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $dbpriv_insert; ?></td>
803 <td bgcolor=
"#E3E3EA" align=
"center">SELECT</td>
804 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $dbpriv_select; ?></td>
807 <td bgcolor=
"#E3E3EA" align=
"center">UPDATE</td>
808 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $dbpriv_update; ?></td>
811 <td bgcolor=
"#E3E3EA" align=
"center">DELETE</td>
812 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $dbpriv_delete; ?></td>
815 <td bgcolor=
"#E3E3EA" align=
"center">DROP TABLE</td>
816 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $dbpriv_droptable; ?></td>
824 <hr noshade align=
"center" width=
"100%" size=
"1">
828 <td><b><font color=
"#FF0000">></font><font color=
"#000000"> <?php echo $lang[
'compare_env']; ?></font></b></td>
833 <table width=
"80%" cellspacing=
"1" bgcolor=
"#000000" border=
"0" align=
"center">
834 <tr bgcolor=
"#3A4273">
835 <td align=
"center"></td>
836 <td align=
"center" style=
"color: #FFFFFF"><?php echo $lang[
'env_required']; ?></td>
837 <td align=
"center" style=
"color: #FFFFFF"><?php echo $lang[
'env_best']; ?></td>
838 <td align=
"center" style=
"color: #FFFFFF"><?php echo $lang[
'env_current']; ?></td>
841 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'env_os']; ?></td>
842 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $lang[
'unlimited']; ?></td>
843 <td bgcolor=
"#E3E3EA" align=
"center">UNIX/Linux/FreeBSD</td>
844 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $curr_os; ?></td>
847 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'env_php']; ?></td>
848 <td bgcolor=
"#EEEEF6" align=
"center">4.3.0+</td>
849 <td bgcolor=
"#E3E3EA" align=
"center">5.2.0+</td>
850 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $curr_php_version; ?></td>
853 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'env_mysql']; ?></td>
854 <td bgcolor=
"#EEEEF6" align=
"center">3.23+</td>
855 <td bgcolor=
"#E3E3EA" align=
"center">4.0.18</td>
856 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $curr_mysql_version; ?></td>
859 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'env_diskspace']; ?></td>
860 <td bgcolor=
"#EEEEF6" align=
"center">10M+</td>
861 <td bgcolor=
"#E3E3EA" align=
"center">50M+</td>
862 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $curr_disk_space; ?></td>
865 <td bgcolor=
"#E3E3EA" align=
"center">./templates <?php echo $lang['env_dir_writeable']; ?></td>
866 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $lang[
'unlimited']; ?></td>
867 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'writeable']; ?></td>
868 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $curr_tpl_writeable; ?></td>
871 <td bgcolor=
"#E3E3EA" align=
"center">./gamedata <?php echo $lang['env_dir_writeable']; ?></td>
872 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $lang[
'unlimited']; ?></td>
873 <td bgcolor=
"#E3E3EA" align=
"center"><?php echo $lang[
'writeable']; ?></td>
874 <td bgcolor=
"#EEEEF6" align=
"center"><?php echo $curr_data_writeable; ?></td>
882 <hr noshade align=
"center" width=
"100%" size=
"1">
886 <td><b><font color=
"#FF0000">></font><font color=
"#000000"> <?php echo $lang[
'confirm_preparation']; ?></font></b></td>
891 <ol><?php echo $lang[
'preparation']; ?></ol>
896 <hr noshade align=
"center" width=
"100%" size=
"1">
900 <td><b><font color=
"#FF0000">></font><font color=
"#000000"> <?php echo $lang[
'install_note']; ?></font></b></td>
908 foreach(explode(
"\t", $msg) as $message) {
909 echo
" <li>$message</li>\n";
917 <input type=
"button" name=
"refresh" value=
"<?php echo $lang['recheck_config']; ?>" style=
"height: 25" onclick=
"javascript: window.location=('?language=<?php echo $language; ?>&action=environment');">&
nbsp;
918 <input type=
"button" name=
"exit" value=
"<?php echo $lang['exit']; ?>" style=
"height: 25" onclick=
"javascript: window.close();">
923 include
'./config.inc.php';
924 include
'./gamedata/system.php';
926 list($nowsec,$nowmin,$nowhour,$nowday,
$nowmonth,
$nowyear,$nowwday,$nowyday,$nowisdst) = localtime(
$now);
931 <form method=
"post" action=
"?language=<?php echo $language; ?>" <?php echo $alert; ?>>
935 <hr noshade align=
"center" width=
"100%" size=
"1">
939 <td><b><font color=
"#FF0000">></font><font color=
"#000000"> <?php echo $lang[
'add_admin']; ?></font></b></td>
944 <table width=
"650" cellspacing=
"1" bgcolor=
"#000000" border=
"0" align=
"center">
945 <tr bgcolor=
"#3A4273">
946 <td align=
"center" width=
"20%" style=
"color: #FFFFFF"><?php echo $lang[
'variable']; ?></td>
947 <td align=
"center" width=
"30%" style=
"color: #FFFFFF"><?php echo $lang[
'value']; ?></td>
948 <td align=
"center" width=
"50%" style=
"color: #FFFFFF"><?php echo $lang[
'comment']; ?></td>
951 <td bgcolor=
"#E3E3EA" width=
"20%">&
nbsp;<?php echo $lang[
'username']; ?></td>
952 <td bgcolor=
"#EEEEF6" width=
"30%"><input type=
"text" name=
"username" value=
"admin" size=
"30"></td>
953 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'username_comment']; ?></td>
956 <td bgcolor=
"#E3E3EA" width=
"20%">&
nbsp;<?php echo $lang[
'brpswd']; ?></td>
957 <td bgcolor=
"#EEEEF6" width=
"30%"><input type=
"password" name=
"brpswd" size=
"30"></td>
958 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'brpswd_comment']; ?></td>
961 <td bgcolor=
"#E3E3EA" width=
"20%">&
nbsp;<?php echo $lang[
'adminmsg']; ?></td>
962 <td bgcolor=
"#EEEEF6" width=
"30%"><textarea cols=
"30" rows=
"4" style=
"overflow:auto" name=
"adminmsg" value=
""></textarea></td>
963 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'adminmsg_comment']; ?></td>
966 <td bgcolor=
"#E3E3EA" width=
"20%">&
nbsp;<?php echo $lang[
'startmode']; ?></td>
967 <td bgcolor=
"#EEEEF6" width=
"30%"><input type=
"radio" name=
"startmode" value=
"1" checked><?php echo $lang[
'startmode_1']; ?><input type=
"radio" name=
"startmode" value=
"2"><?php echo $lang[
'startmode_2']; ?><input type=
"radio" name=
"startmode" value=
"3"><?php echo $lang[
'startmode_3']; ?><input type=
"radio" name=
"startmode" value=
"0"><?php echo $lang[
'startmode_0']; ?></td>
968 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'startmode_comment']; ?></td>
971 <td bgcolor=
"#E3E3EA" width=
"20%">&
nbsp;<?php echo $lang[
'starttime']; ?></td>
972 <td bgcolor=
"#EEEEF6" colspan=
"2"><input type=
"radio" name=
"starttime" value=
"<?php echo $now; ?>" checked><?php echo $lang[
'starttime_1']; ?><input type=
"radio" name=
"starttime" value=
"0"><?php echo $lang[
'starttime_0']; ?><input type=
"text" name=
"setyear" size=
"4" value=
"<?php echo $nowyear; ?>"><?php echo $lang[
'year']; ?><input type=
"text" name=
"setmonth" size=
"2" value=
"<?php echo $nowmonth; ?>"><?php echo $lang[
'month']; ?><input type=
"text" name=
"setday" size=
"2" value=
"<?php echo $nowday; ?>"><?php echo $lang[
'day']; ?><input type=
"text" name=
"sethour" size=
"2" value=
"<?php echo $nowhour; ?>"><?php echo $lang[
'hour']; ?><input type=
"hidden" name=
"startmin" size=
"2" value=
"<?php echo $startmin; ?>"></td>
975 <td bgcolor=
"#E3E3EA" width=
"20%">&
nbsp;<?php echo $lang[
'iplimit']; ?></td>
976 <td bgcolor=
"#EEEEF6" width=
"30%"><input type=
"text" name=
"iplimit" value=
"<?php echo $iplimit; ?>" size=
"30"></td>
977 <td bgcolor=
"#E3E3EA">&
nbsp;<?php echo $lang[
'iplimit_comment']; ?></td>
981 <input type=
"hidden" name=
"action" value=
"install">
982 <input type=
"submit" name=
"submit" value=
"<?php echo $lang['start_install']; ?>" style=
"height: 25" >&
nbsp;
983 <input type=
"button" name=
"exit" value=
"<?php echo $lang['exit']; ?>" style=
"height: 25" onclick=
"javascript: window.close();">
993 $username = $_POST[
'username'];
994 $brpswd = $_POST[
'brpswd']
998 <td><b><?php echo $lang[
'current_process']; ?> </b><font color=
"#0000EE"> <?php echo $lang[
'installing']; ?></font></td>
1002 <hr noshade align=
"center" width=
"100%" size=
"1">
1006 <td><b><font color=
"#FF0000">></font><font color=
"#000000"> <?php echo $lang[
'check_admin']; ?></font></b></td>
1009 <td><?php echo $lang[
'check_admin_validity']; ?>
1014 $msg = $lang[
'admin_username_invalid'];
1017 $msg = $lang[
'admin_password_invalid'];
1020 $brpswd=md5($brpswd);
1026 ... <font color=
"#FF0000"><?php echo $lang[
'fail_reason']; ?> <?php echo $msg; ?></font></td>
1031 <input type=
"button" name=
"back" value=
"<?php echo $lang['go_back']; ?>" onclick=
"javascript: history.go(-1);">
1036 <hr noshade align=
"center" width=
"100%" size=
"1">
1041 <b style=
"font-size: 11px">Powered by <a
href=
"http://loongyou.com" target=
"_blank"><?php echo $lang[
'gamename']; ?> <?php echo
$version; ?></a> , &
nbsp; Copyright © <a href=
"http://www.loongyou.com" target=\
"_blank\">loongyou.com</a>, 2006-2007</b>
1056 echo result(1, 0)."</td>\n
";
1063 <hr noshade align="center
" width="100%
" size="1
">
1067 <td><b><font color="#FF0000
">></font><font color="#000000
"> <?php echo $lang['select_db']; ?></font></b></td>
1070 include './config.inc.php';
1072 if(empty($dbcharset) && ($charset == 'gbk' || $charset == 'big5')) {
1073 $dbcharset = $charset;
1076 include './include/db_'.$database.'.class.php';
1078 $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
1079 $db->select_db($dbname);
1083 echo" <td>$lang[select_db]
$dbname ".result(1, 0)."</td>\n
";
1087 echo" <hr noshade align=\
"center\" width=\"100%\" size=\"1\">\n";
1091 echo
" <td><b><font color=\"#FF0000\">></font><font color=\"#000000\"> $lang[create_table]</font></b></td>\n";
1097 INSERT INTO bra_users (username,`password`,groupid) VALUES ('$username','$brpswd','9');
1104 loginit('newsinfo');
1112 echo $lang['init_game'];
1128 $fp = fopen(
'./gamedata/system.php',
'r');
1129 $systemfile = fread($fp, filesize(
'./gamedata/system.php'));
1132 $systemfile = preg_replace(
"/[$]adminmsg\s*\=\s*[\"'].*?[\"'];/is",
"\$adminmsg = '$adminmsg';", $systemfile);
1133 $systemfile = preg_replace(
"/[$]startmode\s*\=\s*[0-9]+;/is",
"\$startmode = $startmode;", $systemfile);
1134 $systemfile = preg_replace(
"/[$]starthour\s*\=\s*[0-9]+;/is",
"\$starthour = $starthour;", $systemfile);
1135 $systemfile = preg_replace(
"/[$]iplimit\s*\=\s*[0-9]+;/is",
"\$iplimit = $iplimit;", $systemfile);
1137 $fp = fopen(
'./gamedata/system.php',
'w');
1138 @fwrite($fp, trim($systemfile));
1142 echo $lang[
'new_game'];
1146 $nowtime = time()+
$moveut*3600;
1147 $settime = mktime((
int)$_POST[
'sethour'],(
int)$_POST[
'startmin'],0,(
int)$_POST[
'setmonth'],(
int)$_POST[
'setday'],(
int)$_POST[
'setyear']);
1148 $starttime = $nowtime > $settime ? $nowtime : $settime;
1151 $fp = fopen(
'./install/gameinfo.php',
'r');
1152 $systemfile = fread($fp, filesize(
'./install/gameinfo.php'));
1155 $systemfile = preg_replace(
"/[$]starttime\s*\=\s*[0-9]+;/is",
"\$starttime = $starttime;", $systemfile);
1157 $fp = fopen(
'./gamedata/gameinfo.php',
'w+');
1158 @fwrite($fp, trim($systemfile));
1169 <hr noshade align=
"center" width=
"100%" size=
"1">
1174 <font color=
"#FF0000"><b><?php echo $lang[
'install_succeed']; ?></font><br>
1175 <?php echo $lang[
'username']; ?></b> <?php echo $username; ?><br><br>
1176 <a href=
"<?php echo $gameurl; ?>" target=
"_blank"><?php echo $lang[
'goto_game']; ?></a>
1186 <hr noshade align=
"center" width=
"100%" size=
"1">
1191 <b style=
"font-size: 11px">Powered by <a href=
"http://loongyou.com" target=
"_blank"><?php echo $lang[
'gamename']; ?> <?php echo
$version; ?></a> , &
nbsp; Copyright © <a href=
"http://www.loongyou.com" target=\
"_blank\">loongyou.com</a>, 2006-2007</b>
1203 function loginit($logfile) {
1206 echo $lang['init_log'].' '.$logfile;
1207 $fp = @fopen('./gamedata/'.$logfile.'.php', 'w');
1208 @fwrite($fp, "<?
if(!defined(\
"IN_GAME\")) exit(\"Access Denied\"); ?>\n");
1216 $sql = str_replace(
"\r",
"\n", str_replace(
' bra_',
' '.$tablepre, $sql));
1219 foreach(explode(
";\n", trim($sql)) as $query) {
1220 $queries = explode(
"\n", trim($query));
1221 foreach($queries as $query) {
1222 $ret[$num] .= $query[0] ==
'#' || $query[0].$query[1] ==
'--' ?
'' : $query;
1228 foreach($ret as $query) {
1229 $query = trim($query);
1231 if(substr($query, 0, 12) ==
'CREATE TABLE') {
1232 $name = preg_replace(
"/CREATE TABLE ([a-z0-9_]+) .*/is",
"\\1", $query);
1233 echo $lang[
'create_table'].
' '.$name.
' ... <font color="#0000EE">'.$lang[
'succeed'].
'</font><br>';
1246 $text =
'... <font color="#0000EE">'.$lang[
'succeed'].
'</font><br>';
1252 $text =
'... <font color="#FF0000">'.$lang[
'fail'].
'</font><br>';
1265 if($fp = @fopen(
"$dir/test.test",
'w')) {
1267 @unlink(
"$dir/test.test");
1279 echo $lang[
'clear_dir'].
' '.
$dir;
1280 $directory = dir(
$dir);
1281 while($entry = $directory->read()) {
1282 $filename =
$dir.
'/'.$entry;
1283 if(is_file($filename)) {
1287 $directory->close();
1293 $chars =
'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
1294 $max = strlen($chars) - 1;
1295 mt_srand((
double)microtime() * 1000000);
1296 for(
$i = 0;
$i < $length;
$i++) {
1297 $hash .= $chars[mt_rand(0, $max)];
1303 $type = strtoupper(preg_replace(
"/^\s*CREATE TABLE\s+.+\s+\(.+?\).*(ENGINE|TYPE)\s*=\s*([a-z]+?).*$/isU",
"\\2", $sql));
1304 $type = in_array($type, array(
'MYISAM',
'HEAP')) ? $type :
'MYISAM';
1305 return preg_replace(
"/^\s*(CREATE TABLE\s+.+\s+\(.+?\)).*$/isU",
"\\1", $sql).
1306 (mysql_get_server_info() >
'4.1' ?
" ENGINE=$type DEFAULT CHARSET=$dbcharset" :
" TYPE=$type");
1310 if(!get_magic_quotes_gpc()) {
1311 $string = str_replace(
'\'',
'\\\'', $string);
1313 $string = str_replace(
'\"',
'"', $string);
if(!$action) elseif($action== 'config') elseif($action== 'dbselect') elseif($action== 'environment') elseif($action== 'install') runquery($sql)
< inputtype="radio"name="tplrefresh"value="0"<?phpif(!$tplrefresh){?> checked
if(PHP_VERSION< '4.3.0') $action
【生存者数:<?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)
config($file= '', $cfg=1)
createtable($sql, $dbcharset)
result($result=1, $output=1)
if(!$cuser||!$cpass) $result
adminlog($op, $an1='', $an2='', $an3='')
if(!defined('IN_ADMIN')) $adminmsg