📄 install.php
字号:
</tr>
<tr>
<td align="center">
<form method="post" action="?language=<?=$language?>">
<input type="hidden" name="action" value="environment">
<input type="submit" name="submit" value="<?=$lang['confirm_config']?>" style="height: 25">
<input type="button" name="exit" value="<?=$lang['refresh_config']?>" style="height: 25" onclick="javascript: window.location=('?language=<?=$language?>&action=config');">
</form>
</td>
</tr>
<?
}
} else {
?>
<tr>
<td align="center">
<br>
<form method="post" action="?language=<?=$language?>">
<input type="hidden" name="action" value="config">
<input type="submit" name="submit" value="<?=$lang['recheck_config']?>" style="height: 25">
<input type="button" name="exit" value="<?=$lang['exit']?>" style="height: 25" onclick="javascript: window.close();">
</form>
</td>
</tr>
<?
}
} elseif($action == 'dbselect') {
$exist_error = FALSE;
$write_error = FALSE;
if(file_exists('./config.inc.php')) {
$fileexists = result(1, 0);
} else {
$fileexists = result(0, 0);
$exist_error = TRUE;
$config_info = $lang['config_nonexistence'];
}
if(is_writeable('./config.inc.php')) {
$filewriteable = result(1, 0);
$config_info = $lang['choice_or_new_db'];
} else {
$filewriteable = result(0, 0);
$write_error = TRUE;
$config_info = $lang['config_unwriteable'];
}
?>
<tr>
<td><b><?=$lang['current_process']?> </b><font color="#0000EE"><?=$lang['forum_db_conf']?></font></td>
</tr>
<tr>
<td>
<hr noshade align="center" width="100%" size="1">
</td>
</tr>
<tr>
<td><b><font color="#FF0000">></font><font color="#000000"> <?=$lang['check_config']?></font></b></td>
</tr>
<tr>
<td>config.inc.php <?=$lang['check_existence']?> <?=$fileexists?></td>
</tr>
<tr>
<td>config.inc.php <?=$lang['check_writeable']?> <?=$filewriteable?></td>
</tr>
<tr>
<td>
<hr noshade align="center" width="100%" size="1">
</td>
</tr>
<tr>
<td><b><font color="#FF0000">></font><font color="#000000"><?=$lang['show_and_edit_db_conf']?></font></b></td>
</tr>
<tr>
<td align="center"><br><?=$config_info?></td>
</tr>
<tr>
<td align="center">
<br>
<form method="post" action="?language=<?=$language?>">
<table width="40%" cellspacing="1" bgcolor="#000000" border="0" align="center">
<tr bgcolor="#3A4273">
<td align="center" colspan="3" style="color: #FFFFFF"><?=$lang['db_set']?></td>
</tr>
<?
if(!$exist_error) {
if(!$write_error) {
if($_POST['saveconfig'] && is_writeable('./config.inc.php')) {
$dbhost = setconfig($_POST['dbhost']);
$dbuser = setconfig($_POST['dbuser']);
$dbpw = setconfig($_POST['dbpw']);
$adminemail = setconfig($_POST['adminemail']);
$tablepre = setconfig($_POST['tablepre']);
$fp = fopen('./config.inc.php', 'r');
$configfile = fread($fp, filesize('./config.inc.php'));
fclose($fp);
$configfile = preg_replace("/[$]dbhost\s*\=\s*[\"'].*?[\"'];/is", "\$dbhost = '$dbhost';", $configfile);
$configfile = preg_replace("/[$]dbuser\s*\=\s*[\"'].*?[\"'];/is", "\$dbuser = '$dbuser';", $configfile);
$configfile = preg_replace("/[$]dbpw\s*\=\s*[\"'].*?[\"'];/is", "\$dbpw = '$dbpw';", $configfile);
$configfile = preg_replace("/[$]adminemail\s*\=\s*[\"'].*?[\"'];/is", "\$adminemail = '$adminemail';", $configfile);
$configfile = preg_replace("/[$]tablepre\s*\=\s*[\"'].*?[\"'];/is", "\$tablepre = '$tablepre';", $configfile);
$fp = fopen('./config.inc.php', 'w');
fwrite($fp, trim($configfile));
fclose($fp);
}
include './config.inc.php';
include './include/db_'.$database.'.class.php';
$db = new dbstuff;
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
$query = $db->query("CREATE DATABASE cdb_temp", 'SILENT');
if($db->error()) {
$createerror = TRUE;
} else {
$query = $db->query("DROP DATABASE cdb_temp", 'SILENT');
$createerror = FALSE;
}
$query = $db->query("SHOW DATABASES", 'SILENT');
$option = '';
if($query) {
while($database = $db->fetch_array($query)) {
if($database['Database'] != 'mysql') {
$option .= '<option value="'.$database['Database'].'"' .($dbname == $database['Database'] ? ' selected' : '') . '>'.$database['Database']."</option>";
}
}
}
if(!empty($option)) {
?>
<tr>
<td bgcolor="#EEEEF6">
<input name="type" type="radio" value="2" checked style="background-color:#EEEEF6">
<?=$lang['db_use_existence']?>:
</td>
<td bgcolor="#EEEEF6">
<select name="dbnameselect" style="width:200px"><?=$option?></select>
</td>
</tr>
<?
}
if(!$createerror) {
?>
<tr>
<td bgcolor="#EEEEF6">
<input name="type" type="radio" value="1" style="background-color:#EEEEF6"<?=((empty($option)) ? ' checked' : '')?>>
<?=$lang['db_create_new']?>:
</td>
<td bgcolor="#EEEEF6">
<input type="text" name="dbname" value="<?=$dbname?>" style="width:200px">
</td>
</tr>
<?
}
if($createerror && empty($option)) {
?>
<tr>
<td bgcolor="#EEEEF6">
<?=$lang['choice_one_db']?>:
</td>
<td bgcolor="#EEEEF6">
<input type="text" name="dbname" value="<?=$dbname?>" style="width:200px">
</td>
</tr>
<?
}
?>
</table>
</td>
</tr>
<?
} else {
@include './config.inc.php';
?>
<tr>
<td bgcolor="#EEEEF6">
<?=$lang['db']?>:
</td>
<td bgcolor="#EEEEF6">
<input type="hidden" name="dbname" value="<?=$dbname?>"><?=$dbname?>
</td>
</tr>
</table>
</td>
</tr>
<?
}
?>
<tr>
<td align="center">
<br>
<input type="hidden" name="action" value="environment">
<input type="hidden" name="saveconfig" value="1">
<input type="submit" name="submit" value="<?=$lang['save_config']?>" style="height: 25">
<input type="button" name="exit" value="<?=$lang['exit']?>" style="height: 25" onclick="javascript: window.close();">
</td>
</tr>
</form>
<?
}
if($exist_error) {
?>
<tr>
<td align="center">
<br>
<form method="post" action="?language=<?=$language?>">
<input type="hidden" name="action" value="config">
<input type="submit" name="submit" value="<?=$lang['recheck_config']?>" style="height: 25">
<input type="button" name="exit" value="<?=$lang['exit']?>" style="height: 25" onclick="javascript: window.close();">
</form>
</td>
</tr>
<?
}
} elseif($action == 'environment') {
if($_POST['saveconfig'] && is_writeable('./config.inc.php')) {
$dbname = ($_POST['type'] == 1) ? $_POST['dbname'] : $_POST['dbnameselect'];
$dbname = setconfig($dbname);
$fp = fopen('./config.inc.php', 'r');
$configfile = fread($fp, filesize('./config.inc.php'));
fclose($fp);
$configfile = preg_replace("/[$]dbname\s*\=\s*[\"'].*?[\"'];/is", "\$dbname = '$dbname';", $configfile);
$fp = fopen('./config.inc.php', 'w');
fwrite($fp, trim($configfile));
fclose($fp);
}
include './config.inc.php';
include './include/db_'.$database.'.class.php';
$db = new dbstuff;
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
$msg = '';
$quit = FALSE;
$curr_os = PHP_OS;
$curr_php_version = PHP_VERSION;
if($curr_php_version < '4.0.6') {
$msg .= "<font color=\"#FF0000\">$lang[php_version_406]</font>\t";
$quit = TRUE;
}
if(@ini_get(file_uploads)) {
$max_size = @ini_get(upload_max_filesize);
$curr_upload_status = $lang['attach_enabled'].$max_size;
$msg .= $lang['attach_enabled_info'].$max_size."\t";
} else {
$curr_upload_status = $lang['attach_disabled'];
$msg .= "<font color=\"#FF0000\">$lang[attach_disabled_info]</font>\t";
}
$query = $db->query("SELECT VERSION()");
$curr_mysql_version = $db->result($query, 0);
if($curr_mysql_version < '3.23') {
$msg .= "<font color=\"#FF0000\">$lang[mysql_version_323]</font>\t";
$quit = TRUE;
}
$curr_disk_space = intval(diskfreespace('.') / (1024 * 1024)).'M';
if(dir_writeable('./templates')) {
$curr_tpl_writeable = $lang['writeable'];
} else {
$curr_tpl_writeable = $lang['unwriteable'];
$msg .= "<font color=\"#FF0000\">$lang[unwriteable_template]</font>\t";
}
if(dir_writeable('./customavatars')) {
$curr_avatar_writeable = $lang['writeable'];
} else {
$curr_avatar_writeable = $lang['unwriteable'];
$msg .= "<font color=\"#FF0000\">$lang[unwriteable_avatar]</font>\t";
}
if(dir_writeable($attachdir)) {
$curr_attach_writeable = $lang['writeable'];
} else {
$curr_attach_writeable = $lang['unwriteable'];
$msg .= "<font color=\"#FF0000\">$lang[unwriteable_attach]</font>\t";
}
if(dir_writeable('./forumdata')) {
$curr_data_writeable = $lang['writeable'];
} else {
$curr_data_writeable = $lang['unwriteable'];
$msg .= "<font color=\"#FF0000\">$lang[unwriteable_forumdata]</font>\t";
}
if(dir_writeable('./forumdata/templates')) {
$curr_template_writeable = $lang['writeable'];
} else {
$curr_template_writeable = $lang['unwriteable'];
$msg .= "<font color=\"#FF0000\">$lang[unwriteable_forumdata_template]</font>\t";
$quit = TRUE;
}
if(dir_writeable('./forumdata/cache')) {
$curr_cache_writeable = $lang['writeable'];
} else {
$curr_cache_writeable = $lang['unwriteable'];
$msg .= "<font color=\"#FF0000\">$lang[unwriteable_forumdata_cache]</font>\t";
$quit = TRUE;
}
if(dir_writeable('./forumdata/threadcaches')) {
$curr_threadcaches_writeable = $lang['writeable'];
} else {
$curr_threadcaches_writeable = $lang['unwriteable'];
$msg .= "<font color=\"#FF0000\">$lang[unwriteable_forumdata_threadcaches]</font>\t";
$quit = TRUE;
}
if(strstr($tablepre, '.')) {
$msg .= "<font color=\"#FF0000\">$lang[tablepre_invalid]</font>\t";
$quit = TRUE;
}
$db->select_db($dbname);
if($db->error()) {
if($db->version() > '4.1') {
$db->query("CREATE DATABASE IF NOT EXISTS $dbname DEFAULT CHARACTER SET $dbcharset");
} else {
$db->query("CREATE DATABASE IF NOT EXISTS $dbname");
}
if($db->error()) {
$msg .= "<font color=\"#FF0000\">$lang[db_invalid]</font>\t";
$quit = TRUE;
} else {
$db->select_db($dbname);
$msg .= "$lang[db_auto_created]\t";
}
}
$query = $db->query("CREATE TABLE cdb_test (test TINYINT (3) UNSIGNED)", 'SILENT');
if($db->error()) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -