📄 install.php
字号:
<?php
foreach($_POST as $_key=>$_value){
$_POST[$_key]=str_replace('$',' $',$_POST[$_key]);
!ereg("^\_",$_key) && $$_key=$_POST[$_key];
}
foreach($_GET as $_key=>$_value){
$_GET[$_key]=str_replace('$',' $',$_GET[$_key]);
!ereg("^\_",$_key) && $$_key=$_GET[$_key];
}
if($info){
phpinfo();
exit;
}
if($step[1]){
$config = "<?php
\$dbhost = \"$hosturl\";
\$dbuser = \"$hostuser\";
\$dbpwd = \"$hostpw\";
\$dbname = \"$hostname\";
\$tablepre = \"$hostf\";
?>";
$handle=fopen('./config.php','rb+');
flock($handle,LOCK_EX);
fputs($handle,$config);
ftruncate($handle,strlen($config));
fclose($handle);
if(file_exists("./config.php")){
include './global.php';
$sqldb = readover(R_P.'sql.txt');
$sqls = splitsql($sqldb);
$table = array('1' => 'xydw_admin','3'=>'xydw_adminset','5' => 'xydw_ads','7'=>'xydw_art','9' => 'xydw_comment','11'=>'xydw_lanmu','13'=>'xydw_link','15'=>'xydw_person_lanmu','17'=>'xydw_person_pic','19'=>'xydw_root','21'=>'xydw_styles','23'=>'xydw_up','25'=>'xydw_votes','27'=>'xydw_zhuanti');
foreach($sqls as $sql){
$query = $db->query($sql);
if($table[$install_sql]){
if($query) $ok .= "建立{$table[$install_sql]}表成功<br>";
else $ok .= "建立<font color=red>{$table[$install_sql]}</font>表失败<br>";
}
$install_sql++;
}
}
}
if($step[2] && $user){
include './global.php';
if($p != $pw){
header("location:install.php?step[2]=1");
exit;
}
$pw=md5($pw);
$db->query("INSERT INTO `xydw_admin` VALUES (1, '$user', '$pw', 1)");
@unlink(R_P."install.php");
@unlink(R_P."sql.txt");
if(file_exists(R_P."install.php")) {
echo "<div style='font-size:12px;color:#000000'>完成安装。请检查install.php是否还在您的服务器上,如果在请删除。<br><a href='admin.php?action=login'>点这里进入后台管理</a>";
exit;
}
header("location:admin.php");
}
function splitsql($sql){
$sql = str_replace("\r", "\n", $sql);
$ret = array();
$num = 0;
$queriesarray = explode(";\n", trim($sql));
unset($sql);
foreach($queriesarray as $query) {
$queries = explode("\n", trim($query));
foreach($queries as $query) {
$ret[$num] .= $query[0] == "#" ? NULL : $query;
}
$num++;
}
return($ret);
}
$file_con=is_writable("./config.php");
$file_data=is_writable("./data");
$file_html=is_writable("./html_data");
if(!$file_con){
$erro="config.php不可写入,请先更改其属性为0777<br>";
}
if(!$file_data){
$erro.="data文件夹不可写入,请先更改其属性为0777,并且将其中的其所有子文件夹和文件都更改<br>";
}
if(!$file_html){
$erro.="html_data文件夹不可写入,请先更改其属性为0777,并且将其中的其所有子文件夹和文件都更改<br>";
}
$erro=="" ? $stepbeg="文件写入检测通过。接下来让我们开始安装。" : $stepbeg="$erro 然后刷新再测试<br><br>如果无法改变那么请尝试安装。";
if(!$step){
$read = "<br><br><div align=center>心雨程序使用协议</div><br><FONT color=#008000> 很高兴你能喜欢我们提供的程序,希望我们提供的程序能给你的网站建设带来便利,或者我们的技术对你有所帮助。<BR><BR> 使用本站程序前请先阅读以下授权协议,一旦你开始使用本站提供的程序即认为你已同意本授权协议的全部内容,如果出现纠纷,我们将根据相关法律和协议条款追究责任。<BR><BR> 美丽心雨和心雨全站两套程序均是心雨动网独立开发制作的,用户同意本协议后即可免费获得及非商业用途使用本程序,而不必支付费用。<BR><BR> 你可以自由的查看、修改程序代码,但无论如何,即无论用途如何、是否改动、改动程度如何,你必须在页脚处保留Powered By Xydw.com的程序制作申明文字和本站的连接。您修改后的代码,在没有获得本站许可的情况下,严禁公开以自己的名义发布或者发售。<BR><BR> 用户出于自愿而使用本软件,我们不承诺对提供任何形式的技术支持(商业注册用户我们提供本站程序使用相应的技术支持)、使用担保,也不承担任何因使用本软件而产生问题的相关责任。<BR><BR> 对于且仅对于非营利性个人用户,欢迎您在保留版权信息和说明档的前提下,传播和转载本程序。在未获得商业授权前,严禁将本本软件用于商业用途或盈利性站点,获取商业授权请见心雨论坛(bbs.xydw.com)->购买程序。<BR><BR> 欢迎对本站程序感兴趣并且有实力的个人或团体对本站程序的开发提供支持!<BR><BR> 安装使用本站程序建立在完全同意本授权协议的基础之上,因此而产生的纠纷,违反本协议的一方将承担全部民事与刑事责任。 <BR><BR>注册程序见:</FONT><A href=\"http://www.xydw.com/bbs/viewthread.php?tid=2\" target=_blank><FONT color=#000000 size=2>注册本站程序</FONT></A><BR><FONT color=#008000>Copyright 2004-2005 心雨动网 All Right Reserved. </font><BR>";
$read .="<br> <font color=red>$stepbeg</font>";
}
print <<<xydw_end
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>美丽心雨安装程序——Powered br XYDW</title>
<style type="text/css">
<!--
BODY {
font-family:"宋体";
font-size:12px;
color:#000000;
margin:5px;
scrollbar-3dlight-color :#B26600;
scrollbar-highlight-color : #FFFFFF;
scrollbar-face-color : #FFFFFF;
scrollbar-arrow-color : #000000;
}
A {
text-decoration:none;
color:#000000;
}
TD {
FONT-SIZE: 12px;
COLOR: #000000;
}
.head {
background-color:#F3D7B4;
color:#B26600;
font-size:12px;
}
-->
</style>
</head>
<body>
<table width="770" align="center" cellspacing="1px" bgcolor="#B26600" cellpadding="0px">
<tr><td>
<table border=0 bgcolor=#ffffff cellspacing="1px" width="770" align=center>
<tr><td class="head" height="25px">欢迎你使用美丽心雨新闻文章系统>> 美丽心雨安装程序</td></tr></table>
</td></tr>
<tr>
<td bgcolor="#FFFFFF">{$read}<br>
xydw_end;
if($step==""){print <<<xydw_end
<table width="80%" border="0" cellspacing="1px" cellpadding="5px" bgcolor="#B26600" align="center">
<form name="form1" method="post" action="install.php"><tr>
<td align="center" class="head" colspan=2>开始安装:填入数据库资料</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%">请输入数据库地址:</td>
<td><input name="hosturl" type="text" id="hosturl" value="localhost" size="30"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%">请输入数据库名称:</td>
<td><input name="hostname" type="text" id="hostname" size="30"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%">请输入数据库用户名:</td>
<td><input name="hostuser" type="text" id="hostuser" size="30"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%">请输入数据库密码:</td>
<td><input name="hostpw" type="text" id="hostpw" size="30"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%">请输入数据库表前缀:(这个是程序将要建立的数据表,你可以填入其它前缀,最好不改动。)</td>
<td><input name="hostf" type="text" id="hostf" value="xydw_" size="30"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="center" class="head" colspan=2><input name="step[1]" type="submit"value="提交" size="30"></td>
</tr> </form>
</table>
</td>
</tr>
</table>
xydw_end;
} if($ok){ print <<<xydw_end
<table width="80%" border="0" cellspacing="1px" cellpadding="5px" bgcolor="#B26600" align="center">
<tr>
<td align="center" class="head">建立数据表状态,如果有错误发生请重新安装或向我们提问。</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>{$ok}<br><br></td>
</tr>
xydw_end;
} if($ok || $step[2]){ print <<<xydw_end
<tr><td class="head" align=center>$ok2</td>
</tr> <form name="form1" method="post" action="install.php">
<tr bgcolor="#FFFFFF">
<td>用户名:<input name="user" type="text" size="30"><br><br></td>
</tr>
<tr bgcolor="#FFFFFF">
<td>密 码:<input name="pw" type="text" size="30"><br><br></td>
</tr>
<tr bgcolor="#FFFFFF">
<td>确 认:<input name="p" type="text" size="30"><br><br></td>
</tr><tr>
<td align="center" class="head"><input name="step[2]" type="submit"value="提交" size="30"></td>
</tr></form>
xydw_end;
} print <<<xydw_end
</table>
xydw_end;
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -