?? 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 + -