📄 install.php
字号:
<?
/*
[FTB] install.php - installation of Fallingstar Board
This is a freeware!
Version: 1.0.0(BUG Fixed)
Author: ofstar(流星) (webmaster@ofstar.com)
Copyright: Fallingstar Board (www.ofstar.com)
Last Modified: 2003/7/8 12:20
*/
function writetofile($file_name,$data,$method="w") {
$filenum=fopen($file_name,$method);
flock($filenum,LOCK_EX);
$file_data=fwrite($filenum,$data);
fclose($filenum);
return $file_data;
}
function readfromfile ($path) {
if(file_exists($path)==0) {
return "";
} else {
$filesize=filesize($path);
$filenum=fopen($path,"r");
flock($filenum,LOCK_SH);
$filestuff=fread($filenum,$filesize);
fclose($filenum);
return $filestuff;
}
}
?>
<html><head><title>FTB Installation Wizard</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<style type="text/css">
.t {font-family: Verdana, Arial, Sans-serif;font-size : 12px;padding-left: 10px;font-weight: normal;line-height: 150%;color : #333366;}
.r {font-family: Arial, Sans-serif;font-size : 12px;font-weight: normal;line-height: 200%;color : #0000EE;}
.c {font-family: Arial, Sans-serif;font-size : 12px;font-weight: normal;line-height: 200%;color : #EE0000;}
.h {font-family: Arial, Sans-serif;padding-top: 5px;padding-left: 10px;font-size : 20px;font-weight: bold;color : #000000;}
.i {font-family: Arial, Sans-serif;padding-top: 5px;padding-left: 10px;font-size : 14px;font-weight: bold;color : #000000;}
table {width : 80%;align : center;vertical-align: top;background-color: #e8f4ff;}
</style>
<body bgcolor=#99ccff leftmargin=0 topmargin=5 marginwidth="0" marginheight="0">
<table width="95%" cellspacing=0 cellpadding=0 align=center bgcolor=#f2f8ff border=0>
<form action=install.php method=post>
<tr>
<td class=h valign=top align=left colspan=2><span
style="COLOR: #cc0000">>></span> FTB Installation Wizard
<hr noshade align="center" width="100%" size="1">
</td></tr>
<tr>
<td class='t' valign='top' align='left' colspan='2'>
欢迎来到 FTB(流星论坛) 安装向导,安装前请仔细阅读 安装说明里的每处细节后才能开始安装。安装文件夹里同样提供了有关软件安装的说明,请您同样仔细阅读,以保证安装进程的顺利进行。
<hr noshade align="center" width="100%" size="1"><b>注意:</b>
<br>
<span class='r'>此种状况表示状态正确.</span>
<br>
<span class='c'>此种状况表示状态发生错误.</span><hr noshade align="center" width="100%" size="1">
</td>
</tr>
<?
if (!$step) {
echo"<tr>
<td class='t' valign='top' align='left' colspan='2'><b>当前状态:</b>检查论坛文件的可写性<hr noshade align=center width=100% size=1></td>
</tr>";
$check=1;
$correct='<font class=r>OK</font>';
$incorrect='<font class=c>不行,检测不通过</font>';
$writeablefiletocheck=array(
'bbsdata','temp','upload','userdata','userdir',
'bbsdata/admin.php','bbsdata/manager.php','bbsdata/ads.php','bbsdata/wordsfb.php','bbsdata/bannames.php','bbsdata/config.php','bbsdata/dj_user.php','bbsdata/forum_back.php','bbsdata/forumdata.php','bbsdata/forumevent.php','bbsdata/group.php',
'bbsdata/idpath.php','bbsdata/ipbans.php',
'bbsdata/log_adminlogin.php','bbsdata/log_manage.php',
'bbsdata/newinfo.php','bbsdata/newuser.php','bbsdata/ofstar.php','bbsdata/online.php','bbsdata/shareforum.php',
'bbsdata/superadmin.php','bbsdata/tbuser.php','bbsdata/time.php','bbsdata/today.php',
'bbsdata/userlist.php','bbsdata/level.php','bbsdata/ye.php',
'userdata/msgbox','userdata/bank','userdata/song','userdata/style.php',
'userdata/game','userdata/badman','userdata/favorites','userdata/admin','userdata/shop',
'userdata/getmg','userdata/lxvip','userdata/anc','userdata/style.php');
echo "
<TR><td class='i' colspan='2' align='left'>
<span style='color:#CC0000'>></span>检查必要目录和文件是否可写入,如果发生错误,请更改文件/目录属性</td></tr>
<tr><td colspan=2 align=left class='t'>";
echo "讨论区根目录 (ftb目录) ....... ";
if ($fp=fopen('test.test',"w")) {echo $correct; fclose($fp);}
else { echo $incorrect; $check=0; }
echo "<br>";
$count=count($writeablefiletocheck);
for ($i=0; $i<$count; $i++) {
echo "$writeablefiletocheck[$i] ....... ";
if (is_writable($writeablefiletocheck[$i])) echo $correct;
else { echo $incorrect; $check=0; }
echo "<br>";
}
echo "</TD></TR>";
if ($check) {
unlink('test.test');
echo '<TR><td class="i" colspan=2 align=left>
<span style="color:#CC0000">></span>请填写您的贴子存放目录名(如果此目录不存在,程序将尝试建立)</td></tr><tr><TD class=i colSpan=2>您所指定的贴子目录 <input type=text size=30 maxlength=24 name="forumdir" value="" style="background-color:#FEFEFF; color:#0000ff; border: 1 double #B4B4B4"> <input type=submit value="确认继续" style="height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor=\'#FFC864\'" onMouseOut ="this.style.backgroundColor=\'#f3f3f3\'"> <input type="button" name="exit" value="退出安装" onclick="javascript: window.close();" style="height:20px;background-color:#f3f3f3;border:1 solid black" onMouseOver ="this.style.backgroundColor=\'#FFC864\'" onMouseOut ="this.style.backgroundColor=\'#f3f3f3\'"><INPUT type=hidden value=2 name=step></TD></TR>
<tr><TD align=left class=t align=middle colSpan=2><b>注意</b>:此目录放置论坛所有帖子内容,请自己取个名字吧比如 "formyeye"。程序将自动以你所填的目录名自动创建一个贴子目录,如果手工建立在其他目录,请填写完整绝对路径,比如 "/home/bbs/forumyeye"(Unix/Linux) 或者 "c:/forumyeye"(NT)<br>
如果你的空间无法自动建立目录,请您手动先建立贴子目录设定其属性至 777 (linux 右键 全部打钩,再不懂就上google.com 搜索 什么叫777吧)<br><br><br><br><br></TD></TR>';}
}elseif ($step==2) {
$check=1;
echo '<tr>
<td class=t valign=top align=left colspan=2><b>当前状态:</b>检查论坛用户目录与文件目录的正确性<hr noshade align=center width=100% size=1></td>
</tr>';
echo '
<INPUT type=hidden value=3 name=step>
<TR><td class="i" colspan=2 align=left>
<span style="color:#CC0000">></span>检查贴子目录</td></tr>';
if (!$forumdir) {
echo '<tr><TD align=left class=c align=middle colSpan=2>您没有指定目录,请返回</TD></TR>';
$check=0;
}
if ($check && !file_exists($forumdir) && !mkdir("$forumdir", 0777)) {
echo '<tr><TD align=left class=c align=middle colSpan=2>您没有建立该目录,程序尝试建立失败</TD></TR>';
$check=0;
}
if ($check && !file_exists("$forumdir/backup") && !mkdir("$forumdir/backup", 0777)) {
echo '<tr><TD align=left class=c align=middle colSpan=2>您没有建立贴子备份目录backup,程序尝试建立失败</TD></TR>';
$check=0;
}
if ($check && !is_dir($forumdir)) {
echo '<tr><TD align=left class=c align=middle colSpan=2>您所指定的目录是一个文件名,请返回</TD></TR>';
$check=0;
}
if ($check && eregi("^.+/$",$forumdir)) {
echo '<tr><TD align=left class=c align=middle colSpan=2>贴子目录后不用加“/”了,请返回:)</TD></TR>';
$check=0;
}
if ($check && !is_writable($forumdir)) {
echo '<tr><TD align=left class=c align=middle colSpan=2>您所指定的目录无法被写入,请更改属性</TD></TR>';
$check=0;
}
if ($check && !is_writable("$forumdir/backup")) {
echo '<tr><TD align=left class=c align=middle colSpan=2>您所指定的backup目录无法被写入,请更改属性</TD></TR>';
$check=0;
}
if ($check) {
writetofile('bbsdata/idpath.php',"<? \$idpath='$forumdir/';");
echo '<tr><TD align=left class=r align=middle colSpan=2>用户和贴子目录检测完毕,信息已经记录</TD></TR>';
echo "<tr>
<td class='i' colspan='2' align='left'><span style='color:#CC0000'>></span>设置管理员账号<br> </td>
</tr><tr>
<td class='t' align='left' width='40%'> 管理员用户名:</td>
<td class='t' align='left' width='60%'><input type='text' name='MEMBER_NAME'></td>
</tr><tr>
<td class='t' align='left' width='40%'> 管理员 Email:</td>
<td class='t' align='left' width='60%'><input type='text' name='EMAIL'></td>
</tr><tr>
<td class='t' align='left' width='40%'> 管理员密码:</td>
<td class='t' align='left' width='60%'><input type='text' name='MEMBER_PASS'></td>
</tr><tr>
<td class='t' align='left' width='40%'> 重复密码:<br><br></td>
<td class='t' align='left' width='60%'><input type='text' name='MEMBER_PASS_TWO'>
<INPUT type=hidden value='$forumdir' name=forumdir><input type='submit' value='确认完成安装' style=\"height:20px;background-color:#f3f3f3;border:1 solid black\" onMouseOver =\"this.style.backgroundColor='#FFC864'\" onMouseOut =\"this.style.backgroundColor='#f3f3f3'\"><br><br></td>
<tr>";
} else echo "
</tr><tr>
<td class='i' colspan='2' align='center'><input onclick='history.go(-1)' type='button' value='发生错误点击返回' style='font-family:Verdana;width:50%'></td>
<tr>";
}elseif ($step==3) {
$check=1;
echo '<TR><td class="i" colspan=2 align=left>
<span style="color:#CC0000">></span>最后:检查输入资料并写入</td></tr>';
if ($MEMBER_PASS != $MEMBER_PASS_TWO) {
echo '<tr><TD align=left class=c align=middle colSpan=2>您所输入的2个密码不一致</TD></TR>';
$check=0;
}
if ($check) {
$showpwd=$MEMBER_PASS;
writetofile('bbsdata/manager.php',"<? \$manager='$MEMBER_NAME'; \$manager_pwd='$MEMBER_PASS';");
writetofile("userdir/$MEMBER_NAME.php","<?die;?>|$MEMBER_NAME|$MEMBER_PASS||$EMAIL||".time()."|||||||0||none|1000||||||||1000|||||0|||||||||");
$newuserfile = "bbsdata/newuser.php";
if (file_exists($newuserfile)) $newuserinfo=readfromfile($newuserfile);
else $newuserinfo="|0|0";
$newuser_info=explode("|",$newuserinfo);
$newuser_info[1]++;
$newuser_info[0]=$MEMBER_NAME;
writetofile($newuserfile,$newuser_info[0]."|".$newuser_info[1]."|".$newuser_info[2]);
writetofile('bbsdata/userlist.php',$MEMBER_NAME."\n",'a');
if(!(file_exists("upload"))) mkdir("upload",0777);
echo '<tr><TD align=left class=r align=middle colSpan=2>OK,超级用户资料已经写入并已经注册成功</TD></TR>';
echo "<tr><td class='i' colspan='2' align='left'><span style='color:#CC0000'>></span>恭喜您,FTB 论坛 安装成功!<br> </td>
</tr><tr>
<td class='t' align='left' width='50%'> 管理员账号:</td>
<td class='t' align='left' width='50%'><b>Name</b>: $MEMBER_NAME <b>密码为: $showpwd </b></td>
</tr><tr><td class='i' colspan='2' align='left'>
<span style='color:#CC0000'>></span><a href='admin.php'>点击这里进入管理面板,设置您的详细资料并创建版块</a><br><br></td></tr>";
if (!unlink('install.php'))
echo '<tr><TD align=left class=r align=middle colSpan=2>请记住用FTP删除本安装程序</TD></TR>';
}else echo "
</tr><tr>
<td class='i' colspan='2' align='center'><input onclick='history.go(-1)' type='button' value='Error. Return to Check' style='font-family:Verdana;width:50%'></td>
<tr>";
}
?>
</form></table></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -