📄 install.php
字号:
$filestr = str_replace( " ", "", $filestr );
$filestr = str_replace( "DefaultWaStarPath", "", $filestr );
$filestr = str_replace( "DefaultDbHost", $dbhost, $filestr );
$filestr = str_replace( "DefaultDbName", $dbname, $filestr );
$filestr = str_replace( "DefaultDbUser", $dbuser, $filestr );
$filestr = str_replace( "DefaultDbPass", $dbpwd, $filestr );
$filestr = str_replace( "DefaultsLan", $sLan, $filestr );
$filestr = str_replace( "DefaultaLan", $sLan, $filestr );
$filestr = str_replace( "DefaulCharset", $charset, $filestr );
$filestr = str_replace( "DefaulDbCharset", $dbcharset, $filestr );
$filestr = str_replace( "DefaultSiteUrl", $siteurl, $filestr );
fwrite( fopen( $ConFile, "w" ), $filestr, 30000 );
$step_content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\"><input type=\"hidden\" name=\"db_host\" value=\"".$_POST['dbhost']."\"><input type=\"hidden\" name=\"db_name\" value=\"".$_POST['dbname']."\"><input name=\"db_user\" type=\"hidden\" value=\"".$_POST['dbuser']."\"><input name=\"db_pwd\" type=\"hidden\" value=\"".$_POST['dbpwd']."\">";
$step_content .= "<tr><td style=\"font-size: 15px; color: #003399; font-weight:bold;\">第 <strong>5</strong> 步:导入系统初始数据 <br><hr size=\"1\" width=\"98%\" align=\"left\">".$error_msg."</td></tr>";
$step_content .= "<tr><td style=\"font-size: 14px; color: #999999;\">".$table_name."</td></tr>";
$step_content .= "<tr><td style=\"font-size: 14px; color: #999999; line-height: 150%\">".$table_num." 个数据表已导入</td></tr>";
$step_content .= "<tr><td style=\"font-size: 14px; color: #999999;\"><hr size=\"1\" width=\"98%\" align=\"left\"></td></tr>";
$step_content .= "</table>";
$donext = true;
}
}
}
}
if ( $_POST['nextstep'] == 4 )
{
$donext = true;
}
if ( $_POST['nextstep'] == 5 )
{
$admin_user = $_POST['admin_user'];
$admin_pass = $_POST['admin_pass'];
$dbhost = $_POST['dbhost'];
$dbuser = $_POST['dbuser'];
$dbpwd = $_POST['dbpwd'];
$dbname = $_POST['dbname'];
$mdpass = md5( $admin_pass );
$connect = @mysql_connect( $dbhost, $dbuser, $dbpwd );
if ( $connect )
{
$Qsql = "update ".$dbname.".sho_admin set user='{$admin_user}',password='{$mdpass}'";
$Asql = "update ".$dbname.".sho_admin_rights set user='{$admin_user}'";
mysql_query( $Qsql, $connect );
mysql_query( $Asql, $connect );
}
$donext = true;
}
if ( $_POST['nextstep'] == 6 )
{
echo "<script>window.location.href = 'adm/'</script>";
}
if ( $donext )
{
$step = $_POST['nextstep'] + 1;
}
else
{
$step = $_POST['nextstep'];
}
}
else if ( $_POST['command'] == "goprev" )
{
$step = $_POST['nextstep'] - 1;
}
if ( $step != 0 )
{
$prev = "<input id=\"ddd\" type=\"submit\" value=\"<< 上一步\" onClick=\"command.value='goprev'\">";
$next = "<input id=\"subm\" type=\"submit\" value=\">> 下一步\" onClick=\"command.value='gonext'\">";
}
if ( $step == 2 )
{
$step_caption = array(
"0" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"1" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"2" => array( "bgcolor" => "#dddddd", "fontcolor" => "#999999", "tag" => "->" ),
"3" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"4" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"5" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"6" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" )
);
$php_version = substr( PHP_VERSION, 0, 3 ) + 0;
if ( $php_version < 4.2 || 5.2 < $php_version )
{
$phpmsg = "<font color=red style='font-size: 14px; '>× (建议使用PHP4.2.x至5.2.x版本)</font>";
$noinstall = "<script>document.all['subm'].disabled = true;</script>";
}
else
{
$phpmsg = "<font color=#666666 style='font-size: 14px; '>√</font>";
}
if ( get_cfg_var( "safe_mode" ) == 1 )
{
$safe_mode_caption = "ON";
$safemsg = "<font color=red style='font-size: 14px; '>× (本系统在PHP安全模式下不可运行)</font>";
$noinstall = "<script>document.all['subm'].disabled = true;</script>";
}
else
{
$safe_mode_caption = "OFF";
$safemsg = "<font color=#666666 style='font-size: 14px; '>√</font>";
}
if ( !is_writable( "../advs" ) || !is_writable( "../cp" ) || !is_writable( "../down" ) || !is_writable( "../pic" ) || !is_writable( "../form" ) || !is_writable( "../includes" ) || !is_writable( "../link" ) || !is_writable( "../news" ) || !is_writable( "../page" ) || !is_writable( "../templates" ) )
{
$tempdir = "不可写";
$tempmsg = "<font color=red style='font-size: 14px; '>× (请设置advs,cp,down,pic,form,includes,link,news,page,templates目录为可读写,如777,否则无法生成HTML和进行升级)</font>";
$noinstall = "<script>document.all['subm'].disabled = true;</script>";
}
else
{
$tempdir = "可读写";
$tempmsg = "<font color=#666666 style='font-size: 14px; '>√</font>";
}
if ( !is_writable( "../config.inc.php" ) )
{
$confdir = "不可写";
$confmsg = "<font color=red style='font-size: 14px; '>× (请设置config.inc.php文件为可读写,如666)</font>";
$noinstall = "<script>document.all['subm'].disabled = true;</script>";
}
else
{
$confdir = "可读写";
$confmsg = "<font color=#666666 style='font-size: 14px; '>√</font>";
}
$upload = get_cfg_var( "file_uploads" );
if ( $upload != "1" )
{
$uploadsay = "Off";
$uploadmsg = "<font color=red style='font-size: 14px; '>× (请在php.ini中设置file_uploads = On)</font>";
$noinstall = "<script>document.all['subm'].disabled = true;</script>";
}
else
{
$uploadsay = "On";
$uploadmsg = "<font color=#666666 style='font-size: 14px; '>√</font>";
}
$step_content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">";
$step_content .= "<tr><td style=\"font-size: 15px; color: #003399; font-weight:bold;\">第 <strong>3</strong> 步:检测服务器环境<br><hr size=\"1\" width=\"98%\" align=\"left\">".$error_msg."</td></tr>";
$step_content .= "<tr><td style=\"font-size: 14px; color: #999999;\">操作系统:".PHP_OS." ...√</td></tr>";
$step_content .= "<tr><td style=\"font-size: 14px; color: #999999;\">服务器软件:".$_ENV['SERVER_SOFTWARE']." ...√</td></tr>";
$step_content .= "<tr><td style=\"font-size: 14px; color: #999999;\">PHP版本:".$php_version." ...".$phpmsg."</td></tr>";
$step_content .= "<tr><td style=\"font-size: 14px; color: #999999;\">安全模式:".$safe_mode_caption." ...".$safemsg."</td></tr>";
$step_content .= "<tr><td style=\"font-size: 14px; color: #999999;\">目录权限: ".$tempdir." ...".$tempmsg."</td></tr>";
$step_content .= "<tr><td style=\"font-size: 14px; color: #999999;\">设置文件权限: ".$confdir." ...".$confmsg."</td></tr>";
$step_content .= "<tr><td style=\"font-size: 14px; color: #999999;\">文件上传:".$uploadsay." ...".$uploadmsg."</td></tr>";
$step_content .= "</table>";
}
else if ( $step == 3 )
{
$step_caption = array(
"0" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"1" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"2" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"3" => array( "bgcolor" => "#dddddd", "fontcolor" => "#999999", "tag" => "->" ),
"4" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"5" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"6" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" )
);
$step_content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">";
$step_content .= "<tr><td colspan=\"2\" style=\"font-size: 15px; color: #003399; font-weight:bold;\">第 <strong>4</strong> 步:语言和数据库参数设置<br><hr size=\"1\" width=\"98%\" align=\"left\">".$error_msg."</td></tr>";
$step_content .= "<tr><td align=\"right\" style=\"font-size: 14px; color: #000000;\">选择语言版本</td><td>\r\n\t<select name='language'>\r\n <option value='zh_cn_utf8' ".seld( $language, "zh_cn_utf8" ).">简体中文(UTF-8)</option>\r\n <option value='zh_tw_utf8' ".seld( $language, "zh_tw_utf8" ).">繁体中文(UTF-8)</option>\r\n \r\n</select> *</td></tr>";
$step_content .= "<tr><td align=\"right\" style=\"font-size: 14px; color: #000000;\">数据库服务器</td><td><input name=\"dbhost\" type=\"text\" value=\"localhost\" size=\"20\"> *</td></tr>";
$step_content .= "<tr><td align=\"right\" style=\"font-size: 14px; color: #000000;\">数据库名称</td><td><input name=\"dbname\" type=\"text\" size=\"20\" value='".$_POST[dbname]."'> *</td></tr>";
$step_content .= "<tr><td align=\"right\" style=\"font-size: 14px; color: #000000;\">数据库用户</td><td><input name=\"dbuser\" type=\"text\" size=\"20\" value='".$_POST[dbuser]."'> *</td></tr>";
$step_content .= "<tr><td align=\"right\" style=\"font-size: 14px; color: #000000;\">数据库密码</td><td><input name=\"dbpwd\" type=\"text\" size=\"20\" value='".$_POST[dbpwd]."'> *</td></tr>";
$step_content .= "<tr><td colspan=\"2\" style=\"font-size: 14px; color: #999999;\"><hr size=\"1\" width=\"98%\" align=\"left\"></td></tr>";
$step_content .= "</table>";
}
else if ( $step == 4 )
{
$step_caption = array(
"0" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"1" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"2" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"3" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"4" => array( "bgcolor" => "#dddddd", "fontcolor" => "#999999", "tag" => "->" ),
"5" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"6" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" )
);
}
else if ( $step == 5 )
{
$step_caption = array(
"0" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"1" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"2" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"3" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"4" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"5" => array( "bgcolor" => "#dddddd", "fontcolor" => "#999999", "tag" => "->" ),
"6" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" )
);
$step_content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><input type=\"hidden\" name=\"dbhost\" value=\"".$_POST['db_host']."\"><input type=\"hidden\" name=\"dbname\" value=\"".$_POST['db_name']."\"><input name=\"dbuser\" type=\"hidden\" value=\"".$_POST['db_user']."\"><input name=\"dbpwd\" type=\"hidden\" value=\"".$_POST['db_pwd']."\">";
$step_content .= "<tr><td colspan=\"2\" style=\"font-size: 15px; color: #003399; font-weight:bold;\">第 <strong>6</strong> 步:设置网站管理员密码<br><hr size=\"1\" width=\"98%\" align=\"left\">".$error_msg."</td></tr>";
$step_content .= "<tr><td align=\"right\" width=120 style=\"font-size: 14px; \">网站管理员用户名</td><td><input type=\"text\" name=\"admin_user\" value=\"admin\"> * </td></tr>";
$step_content .= "<tr><td align=\"right\" style=\"font-size: 14px; ;\">网站管理员密码</td><td><input type=\"text\" name=\"admin_pass\"> *</td></tr>";
$step_content .= "<tr><td colspan=\"2\" style=\"font-size: 14px; \"><hr size=\"1\" width=\"98%\" align=\"left\"></td></tr>";
$step_content .= "</table>";
}
else if ( $step == 6 )
{
$step_caption = array(
"0" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"1" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"2" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"3" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"4" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"5" => array( "bgcolor" => "#244A6C", "fontcolor" => "#ffffff", "tag" => "" ),
"6" => array( "bgcolor" => "#dddddd", "fontcolor" => "#999999", "tag" => "->" )
);
$prev = "";
$next = "<input id=\"subm\" type=\"button\" value=\"查看网站\" onClick=\"window.location='../'\"> <input id=\"sys\" type=\"button\" value=\"管理登录\" onClick=\"window.open('../adm/','_blank')\">";
$step_content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">";
$step_content .= "<tr><td style=\"font-size: 15px; color: #003399; font-weight:bold;\">第 <strong>7</strong> 步:安装完成<br><hr width=\"98%\" size=\"1\" align=\"left\"></td></tr>";
$step_content .= "<tr><td style=\"font-size: 14px; color: #666666; line-height: 130%\">系统安装完成!<br><br>请删除 [ install ] 目录<br><br></td></tr>";
$step_content .= "</table>";
}
echo "<body topmargin=\"0\" leftmargin=\"0\" bgcolor=\"#396DA5\">\r\n<center>\r\n <table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n <tr>\r\n <td width=\"229\" valign=\"top\" align=\"center\"> \r\n <table width=\"100%\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\">\r\n <tr> \r\n <td align=\"center\"><img src=\"images/installlogo.gif\" width=\"229\" height=\"75\"></td>\r\n </tr";
echo ">\r\n <tr> \r\n <td height=\"130\" valign=\"top\" style=\"font-size:12px;color:#ffffff\"> \r\n </td>\r\n </tr>\r\n <tr> \r\n <td align=\"right\" bgcolor=\"";
echo $step_caption[2]['bgcolor'];
echo "\" class=\"font_13_w\" style=\"border-top: 1 solid #ffffff; border-right: 3 solid #ffcc00; color: ";
echo $step_caption[2]['fontcolor'];
echo "\">";
echo $step_caption[2]['tag'];
echo " 检测服务器环境</td>\r\n </tr>\r\n <tr> \r\n <td align=\"right\" bgcolor=\"";
echo $step_caption[3]['bgcolor'];
echo "\" class=\"font_13_w\" style=\"border-top: 1 solid #ffffff; border-right: 3 solid #ffcc00; color: ";
echo $step_caption[3]['fontcolor'];
echo "\">";
echo $step_caption[3]['tag'];
echo " 设置语言和数据库参数</td>\r\n </tr>\r\n <tr> \r\n <td align=\"right\" bgcolor=\"";
echo $step_caption[4]['bgcolor'];
echo "\" class=\"font_13_w\" style=\"border-top: 1 solid #ffffff; border-bottom: 1 solid #ffffff; border-right: 3 solid #ffcc00; color: ";
echo $step_caption[4]['fontcolor'];
echo "\">";
echo $step_caption[4]['tag'];
echo " 导入系统初始数据</td>\r\n </tr>\r\n <tr> \r\n <td align=\"right\" bgcolor=\"";
echo $step_caption[5]['bgcolor'];
echo "\" class=\"font_13_w\" style=\"border-right: 3 solid #ffcc00; color: ";
echo $step_caption[5]['fontcolor'];
echo "\">";
echo $step_caption[5]['tag'];
echo " 设置网站管理员密码</td>\r\n </tr>\r\n <tr> \r\n <td align=\"right\" bgcolor=\"";
echo $step_caption[6]['bgcolor'];
echo "\" class=\"font_13_w\" style=\"border-top: 1 solid #ffffff; border-bottom: 1 solid #ffffff; border-right: 3 solid #ffcc00; color: ";
echo $step_caption[6]['fontcolor'];
echo "\">";
echo $step_caption[6]['tag'];
echo " 安装完成</td>\r\n </tr>\r\n </table>\r\n <br>\r\n <br>\r\n <table width=\"68%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\r\n <tr> \r\n <td><a href=\"http://www.eb2000.cn\" target=\"_blank\"><img src=\"images/medisoft.gif\" width=\"229\" height=\"75\" border=\"0\"></a></td>\r\n </tr>\r\n </table>\r\n </td>\r\n <td valign=\"top\" bgcolor=\"#FFFFFF\"";
echo "><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n <tr valign=\"top\"> \r\n <td height=\"90\"><img src=\"images/top1.gif\" width=\"764\" height=\"73\"></td>\r\n </tr>\r\n </table>\r\n <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n\t\t<form name=\"form\" action=\"\" method=\"post\" onSubmit=\"return CheckForm (this, '";
echo $step;
echo "');\">\r\n\t\t <tr>\r\n <td style=\"padding-left: 10px; padding-top: 5px; padding-bottom: 5px;\" align=\"left\">";
echo $step_content;
echo "</td>\r\n </tr>\r\n <tr>\r\n <td style=\"padding-left: 10px;\">";
echo $prev;
echo " ";
echo $unagree." ".$next." ".$download;
echo " <input type=\"hidden\" name=\"nextstep\" value=\"";
echo $step;
echo "\">\r\n <input type=\"hidden\" name=\"command\" value=\"gonext\">\r\n <input type=\"hidden\" name=\"alertmsg\" value=\"";
echo $msg;
echo "\">\r\n <input type=\"hidden\" name=\"user_email\" value=\"";
echo $_POST['user_email'];
echo "\">\r\n </td>\r\n </tr>\r\n\t\t </form>\r\n </table></td>\r\n </tr>\r\n </table>\r\n</center>\r\n</body>\r\n</html>\r\n";
echo $noinstall;
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -