📄 install.php
字号:
<br>
<form method="post" action="<?=$PHP_SELF?>">
<input type="hidden" name="action" value="config">
<input type="submit" name="submit" value="重新检查设置" style="height: 25">
<input type="button" name="exit" value="退出安装向导" style="height: 25" onclick="javascript: window.close();">
</form>
</td>
</tr>
<?
}
} elseif($action == 'environment') {
if($HTTP_POST_VARS['saveconfig'] && is_writeable('../config.inc.php')) {
$dbhost = $HTTP_POST_VARS['dbhost'];
$dbuser = $HTTP_POST_VARS['dbuser'];
$dbpw = $HTTP_POST_VARS['dbpw'];
$dbname = $HTTP_POST_VARS['dbname'];
$adminemail = $HTTP_POST_VARS['adminemail'];
$tablepre = $HTTP_POST_VARS['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("/[$]dbname\s*\=\s*[\"'].*?[\"']/is", "\$dbname = '$dbname'", $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 './db_'.$database.'.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.0') {
$msg .= "<font color=\"#FF0000\">您的 PHP 版本小于 4.0.0, 无法使用 J_Space.</font>\t";
$quit = TRUE;
} elseif($curr_php_version < '4.0.6') {
$msg .= "<font color=\"#FF0000\">您的 PHP 版本小于 4.0.6, 无法使用头像尺寸检查和 gzip 压缩功能.</font>\t";
}
if(@ini_get(file_uploads)) {
$max_size = @ini_get(upload_max_filesize);
$curr_upload_status = "允许/最大 $max_size";
$msg .= "您可以上传尺寸在 $max_size 以下的附件文件.\t";
} else {
$curr_upload_status = '不允许上传附件';
$msg .= "<font color=\"#FF0000\">由于服务器屏蔽, 您无法使用附件功能.</font>\t";
}
$query = $db->query("SELECT VERSION()");
$curr_mysql_version = $db->result($query, 0);
if($curr_mysql_version < '3.24') {
$msg .= "<font color=\"#FF0000\">您的 MySQL 版本低于 3.24, J_Space 的一些功能可能无法正常使用.</font>\t";
}
$curr_disk_space = intval(diskfreespace('.') / (1024 * 1024)).'M';
$db->select_db($dbname);
if($db->error()) {
$db->query("CREATE DATABASE $dbname");
if($db->error()) {
$msg .= "<font color=\"#FF0000\">指定的数据库 $dbname 不存在, 系统也无法自动建立, 无法安装 J_Space.</font>\t";
$quit = TRUE;
} else {
$db->select_db($dbname);
$msg .= "指定的数据库 $dbname 不存在, 但系统已成功建立, 可以继续安装.\t";
}
}
$query - $db->query("SELECT COUNT(*) FROM $tablepre"."settings", 1);
if(!$db->error()) {
$msg .= "<font color=\"#FF0000\">数据库中已经安装过 J_Space, 继续安装会清空原有数据.</font>\t";
$alert = " onSubmit=\"return confirm('继续安装会清空全部原有数据,您确定要继续吗?');\"";
} else {
$alert = '';
}
if($quit) {
$msg .= "<font color=\"#FF0000\">由于您目录属性或服务器配置原因, 无法继续安装 J_Space, 请仔细阅读安装说明.</font>";
} else {
$msg .= "您的服务器可以安装和使用 J_Space, 请进入下一步安装.";
}
?>
<tr>
<td><b>当前状态:</b><font color="#0000EE">检查当前服务器环境</font></td>
</tr>
<tr>
<td>
<hr noshade align="center" width="100%" size="1" color="#6699CC">
</td>
</tr>
<tr>
<td><b><font color="#FF0000">></font><font color="#000000"> J_Space 所需环境和当前服务器配置对比</font></b></td>
</tr>
<tr>
<td>
<br>
<table width="80%" cellspacing="1" bgcolor="#6699cc" border="0" align="center">
<tr bgcolor="#6699cc">
<td colspan="2" align="center"><font color="#FFFFFF">当 前 服 务 器</font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="30%" align="center">操作系统</td>
<td width="70%" align="center"><?=$curr_os?></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center">PHP 版本</td>
<td align="center"><?=$curr_php_version?></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center">附件上传</td>
<td align="center"><?=$curr_upload_status?></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center">MySQL 版本</td>
<td align="center"><?=$curr_mysql_version?></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center">磁盘空间</td>
<td align="center"><?=$curr_disk_space?></td>
</tr>
</table>
<br>
</td>
</tr>
<tr>
<td>
<hr noshade align="center" width="100%" size="1" color="#6699CC">
</td>
</tr>
<tr>
<td><b><font color="#FF0000">></font><font color="#000000"> 请确认您已完成以下步骤</font></b></td>
</tr>
<tr>
<td>
<br>
<ol>
<li>将 J_Space 目录下全部文件和目录上传到服务器.</li>
<li>修改服务器上的 config.inc.php 文件以适合您的配置.</li>
</ol>
</td>
</tr>
<tr>
<td>
<hr noshade align="center" width="100%" size="1" color="#6699CC">
</td>
</tr>
<tr>
<td><b><font color="#FF0000">></font><font color="#000000"> 安装向导提示</font></b></td>
</tr>
<tr>
<td>
<br>
<ol>
<?
$msgs = explode("\t", $msg);
unset($msg);
for($i = 0; $i < count($msgs); $i++) {
echo " <li>".$msgs[$i]."</li>\n";
}
echo" </ol>\n";
if($quit) {
?>
<center>
<input type="button" name="refresh" value="重新检查设置" style="height: 25" onclick="javascript: window.location=('<?=$PHP_SELF?>?action=environment');">
<input type="button" name="exit" value="退出安装向导" style="height: 25" onclick="javascript: window.close();">
</center>
<?
} else {
?>
<tr>
<td>
<hr noshade align="center" width="100%" size="1" color="#6699CC">
</td>
</tr>
<tr>
<td><b><font color="#FF0000">></font><font color="#000000"> 设置管理员账号</font></b></td>
</tr>
<tr>
<td align="center">
<br>
<form method="post" action="<?=$PHP_SELF?>"<?=$alert?>>
<table width="300" cellspacing="1" bgcolor="#6699cc" border="0" align="center">
<tr>
<td bgcolor="#E3E3EA" width="40%"> 管理员用户名:</td>
<td bgcolor="#EEEEF6" width="60%"><input type="text" name="username" value="Bati" size="30"></td>
</tr>
<tr>
<td bgcolor="#E3E3EA" width="40%"> 管理员 Email:</td>
<td bgcolor="#EEEEF6" width="60%"><input type="text" name="email" value="webmaster@ewannan.com" size="30"></td>
</tr>
<tr>
<td bgcolor="#E3E3EA" width="40%"> 管理员密码:</td>
<td bgcolor="#EEEEF6" width="60%"><input type="password" name="password1" size="30"></td>
</tr>
<tr>
<td bgcolor="#E3E3EA" width="40%"> 重复密码:</td>
<td bgcolor="#EEEEF6" width="60%"><input type="password" name="password2" size="30"></td>
</tr>
</table>
<br>
<input type="hidden" name="action" value="install">
<input type="submit" name="submit" value="开始安装 J_Space" style="height: 25" >
<input type="button" name="exit" value="退出安装向导" style="height: 25" onclick="javascript: window.close();">
</form>
</td>
</tr>
<?
}
} elseif($action == 'install') {
$username = $HTTP_POST_VARS['username'];
$email = $HTTP_POST_VARS['email'];
$password1 = $HTTP_POST_VARS['password1'];
$password2 = $HTTP_POST_VARS['password2'];
?>
<tr>
<td><b>当前状态:</b><font color="#0000EE">检查管理员账号信息并开始安装 J_Space。</font></td>
</tr>
<tr>
<td>
<hr noshade align="center" width="100%" size="1" color="#6699CC">
</td>
</tr>
<tr>
<td><b><font color="#FF0000">></font><font color="#000000"> 检查管理员账号</font></b></td>
</tr>
<tr>
<td>检查信息合法性
<?
$msg = '';
if($username && $email && $password1 && $password2) {
if($password1 != $password2) {
$msg = "两次输入密码不一致.";
} elseif(strlen($username) > 50) {
$msg = "用户名超过 50 个字符限制.";
} elseif(preg_match("/^$|^c:\\con\\con$| |[,\"\s\t\<\>]|^游客|^Guest/is", $username)) {
$msg = "用户名空或包含非法字符.";
} elseif(!strstr($email, '@') || $email != stripslashes($email) || $email != htmlspecialchars($email)) {
$msg = "Email 地址无效";
}
} else {
$msg = '您的信息没有填写完整.';
}
if($msg) {
?>
... <font color="#FF0000">失败. 原因: <?=$msg?></font></td>
</tr>
<tr>
<td align="center">
<br>
<input type="button" name="back" value="返回上一页修改" onclick="javascript: history.go(-1);">
</td>
</tr>
<tr>
<td>
<hr noshade align="center" width="100%" size="1" color="#6699CC">
</td>
</tr>
<tr>
<td align="center">
<b style="font-size: 11px">Powered by <a href="http://www.ah0553.com" target="_blank">J_Space
<?=$version?>
</a> , Copyright © <a href="http://www.ah0553.com" target=\"_blank\">Bati_ Studio</a>, 2004 </b> </td>
</tr>
</table>
</td>
</tr>
</table>
<br>
</body>
</html>
<?
exit;
} else {
echo result(1, 0)."</td>\n";
echo" </tr>\n";
}
?>
<tr>
<td>
<hr noshade align="center" width="100%" size="1" color="#6699CC">
</td>
</tr>
<tr>
<td><b><font color="#FF0000">></font><font color="#000000"> 选择数据库</font></b></td>
</tr>
<?
include '../config.inc.php';
include './db_'.$database.'.php';
$db = new dbstuff;
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
$db->select_db($dbname);
echo" <tr>\n";
echo" <td>选择数据库 $dbname ".result(1, 0)."</td>\n";
echo" </tr>\n";
echo" <tr>\n";
echo" <td>\n";
echo" <hr noshade align=\"center\" width=\"100%\" size=\"1\">\n";
echo" </td>\n";
echo" </tr>\n";
echo" <tr>\n";
echo" <td><b><font color=\"#FF0000\">></font><font color=\"#000000\"> 建立数据表</font></b></td>\n";
echo" </tr>\n";
echo" <tr>\n";
echo" <td>\n";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -