Discuz!论坛的install.php文件问题
<?php
/*
[Discuz!] (C)2001-2007 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: install4.php 10301 2007-08-25 08:24:28Z cnteacher $
*/
error_reporting(E_ERROR | E_WARNING | E_PARSE);
//输出错误
@set_time_limit(1000);
//设置脚本允许执行的时间
set_magic_quotes_runtime(0);
if(PHP_VERSION < '4.1.0') {
$_GET = &$HTTP_GET_VARS;
$_POST = &$HTTP_POST_VARS;
}
define('IN_DISCUZ', TRUE);
define('DISCUZ_ROOT', '');
//获取本文件的文件名basename()
$installfile = basename(__FILE__);
$sqlfile = './install/discuz.sql';
$lockfile = './forumdata/install.lock';
$attachdir = './attachments';
$attachurl = 'attachments';
$quit = FALSE;
@include './install/install.lang.php';
@include './install/global.func.php';
@include './config.inc.php';
@include './include/db_'.$database.'.class.php';
$inslang = defined('INSTALL_LANG') ? INSTALL_LANG : '';
$version = '6.0.0 '.$lang[$inslang];
//如果没有定义常量INSTALL_LANG或者函数instmsg不存在,或者discuz.sql文件没有可读属性,则提示,并且终止程序if(!defined('INSTALL_LANG') || !function_exists('instmsg') || !is_readable($sqlfile)) {
exit("Please upload all files to install Discuz! Board<br />安装 Discuz! 论坛您必须上传所有文件,否则无法继续");
} elseif(!isset($dbhost) || !isset($cookiepre)) {
instmsg('config_nonexistence');
} elseif(!ini_get('short_open_tag')) {
instmsg('short_open_tag_invalid');
} elseif(file_exists($lockfile)) {
instmsg('lock_exists');
} elseif(!class_exists('dbstuff')) {
instmsg('database_nonexistence');
}
if(function_exists('instheader')) {
instheader();
}
if(empty($dbcharset) && in_array(strtolower($charset), array('gbk', 'big5', 'utf-8'))) {
$dbcharset = str_replace('-', '', $charset);
}
//获取action的值,根据不同的值显示不同的内容
$action = $_POST['action'] ? $_POST['action'] : $_GET['action'];//为什么这里没有出错呢?因为一开始他无法取得action的值啊,下面红色的是我写的,而且一运行就出错,这是为什么?
/**************************************************************************************************
<?php
$action = $_POST['action'] ? $_POST['action'] : $_GET['action'];}
else{echo "对不起,我错了!";}?>***************************************************************************************************/
//-----------------------------------------------------------------------------------------
//如果$action在数组成array()中有check或者config且config.inc.php文件为可写状态则调用result函数输出可写状态并返回值给下标为config的数组$writeable,否则显示不可写
if(in_array($action, array('check', 'config'))) {
if(is_writeable('./config.inc.php')) {
$writeable['config'] = result(1, 0);
$write_error = 0;
} else {
$writeable['config'] = result(0, 0);
$write_error = 1;
}
}
//-----------------------------------------------------------------------------------------
if(!$action) {
//如果$action为假则
//将$lang['license']中的值里的空格替换为HTML标签中的 ,并显示里面的使用条款页面
$discuz_license = str_replace(' ', ' ', $lang['license']);
?>
<tr><td><b><?=$lang['current_process']?> </b><font color="#0000EE"><?=$lang['show_license']?></font></td></tr>
<tr><td><hr noshade align="center" width="100%" size="1"></td></tr>
<tr><td><br />
<table width="90%" cellspacing="1" bgcolor="#000000" border="0" align="center">
<tr><td class="altbg1">
<table width="99%" cellspacing="1" border="0" align="center">
<tr><td><?=$discuz_license?></td>
</tr>
</table></td></tr></table>
</td></tr>
<tr><td align="center">
<br /><form method="post" action="<?=$installfile?>">
<input type="hidden" name="action" value="check">
<input type="submit" name="submit" value="<?=$lang['agreement_yes']?>" style="height: 25">
<input type="button" name="exit" value="<?=$lang['agreement_no']?>" style="height: 25" onclick="javascript: window.close();">
</form></td></tr>
<?
}