📄 install.php
字号:
<?php
require_once ("./include/config.inc.php");
require_once ("./include/class_basic_record_file.php");
require_once ("./include/classes.php");
if (!$action) showBegin();
elseif ($action=="step1") Step1();
elseif ($action=="step2") Step2();
elseif ($action=="step3") Step3();
function showHeader()
{
echo "<HTML><HEAD><TITLE>PKY产品安装程序</TITLE>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">
<style type=\"text/css\">
<!--
A:link {text-decoration:none}
A:visited {text-decoration:none}
A:hover { text-decoration:underline; color:brown;}
p,br,body,td,table,tr,input,select, option, textarea, form {font-family: \"MS Shell Dlg\",\"Verdana\", \"宋体\"; color:black; font-size:9pt;}
-->
</style>
</HEAD>
<BODY bgcolor=\"f5f5f5\" text=\"000000\" leftmargin=\"10\" topmargin=\"10\" marginwidth=\"10\" marginheight=\"10\" link=\"000000\" vlink=\"000000\" alink=\"000000\"><br><center>
<table width=\"88%\" height=\"88%\"border=\"0\" cellspacing=\"1\" cellpadding=\"3\" bgcolor=\"6394bd\">
<tr>
<td bgcolor=\"dee7ef\" align=center><table width=\"76%\"border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td align=\"left\">";
}
function showFooter()
{
echo "</td>
</tr>
</table><center><p>
Copyright © 2002 <a href=\"http://www.puterkey.com\" target=_blank>欢乐家庭网</a>. All rights Reserved
</center> </td>
</tr>
</table>
</BODY>
</HTML>";
}
function showBegin()
{
showHeader();
if(file_exists("install.lok"))
echo "<center>PKY系列产品安装程序</center><p><center>
<b>欢迎您使用欢乐家庭网的最新软件</b><br>
<br><br> <font color=red>系统已安装,如果想重新安装,请将原来的数据备份,然后手工删除install.lok文件重试!</font><br><br><b><a href=\"index.php\"> >> 系统首页 <<</a></b>";
else
echo "<center>PKY产品安装程序</center><p><center>
<b>欢迎您使用欢乐家庭网的系列软件</b><br><font color=red><div align=left>进行安装前,请您确认:<br> 1、已经将系统所有程式文件所在的目录已经修改成777;<br> 2、已经将include目录下面的config.inc.php文件也已经修改成了777;<br>
3、当前目录下以前没有安装过此系统;<br><br></div>
若您确定,请继续。</font><br><br><br>
此安装程式将引导您将PKY产品安装于您的服务器上 <br><br><b><a href=\"install.php?action=step1\"> >> 点击此处执行下一步 <<</a></b>";
showFooter();
}
function Step1()
{
$filecheck=array("modules/main.php", "modules/list.php", "modules/show.php", "modules/review.php", "admin/main.php", "admin/edit.php", "admin/user.php", "admin/append.php", "admin/sort.php", "admin/review.php");
$correct='<font color=green>OK</font>';
$incorrect='<font color=red>不行,检测不通过</font>';
$check=1;
showHeader();
echo "第一步、系统自检,系统将检测是否满足安装条件:<br><HR>";
for ($i=0; $i<count($filecheck); $i++)
{
echo $filecheck[$i]." ....... ";
if (file_exists($filecheck[$i])) echo $correct;
else
{
echo $incorrect;
$check=0;
}
echo "<br>";
}
if (file_exists("index.php")) echo "index.php ....... ".$correct;
else
{
echo "index.php ....... ".$incorrect;
$check=0;
}
//测试是否可以建立文件夹
if(file_exists("datatest.pky")) unlink("datatest.pky");
$fp = fopen("datatest.pky", "wb");
if ($fp and $check==1)
{
fclose($fp);
unlink("datatest.pky");
echo "<br>测试安装目录是否具有写权限 ....... ".$correct;
}
else
{
echo "<br>测试安装目录是否具有写权限 ....... ".$incorrect;
$check = 0;
}
if(is_writeable("./include/config.inc.php") && $check)
{
echo "<br>测试config.inc.php是否具有写权限 ....... ".$correct;
}
else
{
echo "<br>测试config.inc.php是否具有写权限 ....... ".$incorrect;
$check = 0;
}
if($check) echo "</td></tr><tr><td align=right><br><a href=\"install.php?action=step2\"> >> 点击此处执行下一步 <<</a>";
else echo "</tr><tr><td align=right><br>您的空间没有建立目录权限或着由于缺少文件,程序不能执行下一步";
showFooter();
}
function Step2()
{
showHeader();
echo "<br>第二、系统参数设置:<br><HR><table width=100%><tr>
<FORM action=install.php?action=step3 method=post>
<td align='left' colspan=2> <b>建立文本数据库目录</b></td></tr><tr>
<td align='left' width='40%'> 请输入您指定目录名称</td>
<td align='left' width='60%'><input type='text' name='data_dir'> 只需填写英文字母,保证这个目录不名不易被别人猜出,如:pky760816</td>
</tr><table><br>";
echo "<table width=100%><tr>
<td align='left' colspan=2> <b>建立超级用户</b></td></tr><tr>
<td align='left' width='40%'> 请输入超管理员名称</td>
<td align='left' width='60%'><input type='text' name='admin_name'></td>
</tr><tr>
<td align='left' width='40%'> 请输入您的密码</td>
<td align='left' width='60%'><input type='text' name='admin_pass'></td>
</tr><tr>
<td align='left' width='40%'> 请重复输入密码</td>
<td align='left' width='60%'><input type='text' name='admin_pass2'></td>
</tr><tr>
<td align='left' width='40%'> 您的EMAIL 地址</td>
<td align='left' width='60%'><input type='text' name='email'></td>
</tr><tr>
<td align='left' width='40%'> 重复您的EMAIL 地址</td>
<td align='left' width='60%'><input type='text' name='email2'></td>
</tr><tr>
<td align='left' colspan=2> <b>系统设置</b></td></tr><tr>
<td align='left' width='40%'> 系统应用名</td>
<td align='left' width='60%'><input type='text' name='sys_title'>如:家庭下载</td>
</tr><tr>
<td align='left' width='40%'> 系统安装目录</td>
<td align='left' width='60%'><input type='text' name='sys_path'>后面不要加\"/\",如:http://www.yoursite.com/pkydown</td>
</tr><tr>
<td align='left' colspan=2> <b>网站设置</b></td></tr><tr>
<td align='left' width='40%'> 网站名称</td>
<td align='left' width='60%'><input type='text' name='web_name'>如:欢乐家庭网</td>
</tr><tr>
<td align='left' width='40%'> 网站URL</td>
<td align='left' width='60%'><input type='text' name='web_path'>如:http://www.yoursite.com</td>
</tr>
<tr><td colspan=2 align=right><br><input type='submit' value='执行下一步,请点击这里。' >
</td></form></tr>
<table>";
showFooter();
}
function Step3()
{
global $data_dir,$admin_name,$admin_pass,$admin_pass2,$email,$email2,
$sys_path, $sys_title, $web_path, $web_name;
global $set;
$data_dir=trim($data_dir);
$admin_name=trim($admin_name);
$admin_pass=trim($admin_pass);
$admin_pass2=trim($admin_pass2);
$email=trim($email);
$email2=trim($email2);
$sys_title = trim($sys_title);
$sys_path = trim($sys_path);
$web_path = trim($web_path);
$web_name = trim($web_name);
if (!$data_dir or !$admin_name or !$admin_pass or !$admin_pass2 or !$email or !$email2 or $admin_pass!=$admin_pass2 or $email!=$email2 or !$sys_title or !$sys_path or !$web_path or !$web_name) {
showHeader();
echo "<center>PKY系列产品安装程序</center><p><center>
<b>欢迎您使用欢乐家庭网的最新软件</b><br>
<br><br> <font color=red>您添入的数据不完整</font><br><br><b><a href=\"install.php?action=step2\"> >> 点击此处返回上一步 <<</a></b>";
showFooter();
exit();
}
$data_dir = md5($data_dir);
$set[dataPath] = $data_dir;
$set[mgrEmail] = $email;
$set[sysTitle] = $sys_title;
$set[sysPath] = $sys_path;
$set[webPath] = $web_path;
$set[webName] = $web_name;
if (!is_writeable("./include/config.inc.php")) {
showHeader();
echo "<center>PKY系列产品安装程序</center><p><center>
<b>欢迎您使用欢乐家庭网的最新软件</b><br>
<br><br> <font color=red>config.inc.php没有写权限</font><br><br><b><a href=\"install.php?action=step2\"> >> 点击此处返回上一步 <<</a></b>";
showFooter();
exit();
}
$file_content = "<?php
//一般属性
\$set[sysTitle] = \"{$set[sysTitle]}\"; //系统应用名
\$set[sysPath] = \"{$set[sysPath]}\"; //安装目录
\$set[mgrEmail] = \"{$set[mgrEmail]}\"; //管理员信箱
\$set[Announcement] = \"pkyDown下载系统全面升级,此次升级将采用模板显示技术,您可以轻松定制修改模块,使它的样子看上去您更喜欢!\";//最新通告
//数据文件路径
\$set[dataPath] = \"{$set[dataPath]}\"; //数据存储路径,已加密,请勿外泄, 一定一定!!
//模板文件路径
\$set[tplMode] = \"default\"; //模版路径
\$set[tplRoot] = \"templates/\"; //模版文件夹
//网站属性
\$set[webPath] = \"{$set[webPath]}\"; //您网站的URL
\$set[webName] = \"{$set[webName]}\"; //网站名称
//显示属性
\$set[listnumNew] = \"10\"; //最新显示数量
\$set[listnumDownTop] = \"10\"; //排显示数量
\$set[listnumComment] = \"10\"; //最新推荐显示数量
\$set[listnumBriefChar] = \"50\"; //列表中显示软件介绍的字符长度
\$set[listnumClassObject] = \"8\"; //显示大类时第个小类显示最新文章数
\$set[listnumNameLen] = \"28\"; //最新、排行等显示字符长度
//分页显示属性
\$set[listnumPage] = \"7\"; //每页显示的主题数量
\$set[listnumSegment] = \"8\"; //主题分页显示每段显示页数
\$set[listnumUser] = \"10\"; //列表中每页显示用户的数量
\$set[pagenumReview] = \"5\"; //评论每页显示数量
//其它属性
\$set[dateformat] = \"Y-m-d\"; //日期格式
?".">";
$fp=fopen("./include/config.inc.php","w");
fwrite($fp, $file_content);
fclose($fp);
$aUser = new CUser;
$aUser->checkSystem();
$aUser->open();
if(!$aUser->findByName($admin_name))
{
$aUser->appendNew();
$aUser->username = $admin_name;
$aUser->password = $admin_pass;
$aUser->groupid = "1";
$aUser->reserved = $email;
$aUser->update();
}
$aUser->close();
showHeader();
echo "<center>PKY产品安装程序</center><p><center>
<b>欢迎您使用欢乐家庭网的最新软件</b><br>
<br><br> <font color=red>您已经成功将系统安装在您的网站上了 </font><br><br><b><a href=\"admin.php\"> >> 点击此处进入管理面版 <<</a></b>";
showFooter();
$fp = fopen("install.lok", "wb");
fclose($fp);
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -