<?php
/*********************************************************
程序名称：站长助手 WEBMASTER HELPER
作者：feixin
email:kusite@etang.com
版权：feixin (http://www.zc18.com)
//////////////////////////////////////////////////////////

最后编辑日期：2003-6-12
*********************************************************/

if (!defined('IN_WH')) {
  die("不要黑我啊");
}

include("./include/mysql.php");
if(WH_DB_USER != ""){
	$db = new WHmysql(WH_DB_HOST, WH_DB_NAME, WH_DB_USER, WH_DB_PW, 0);
}
?>

<table align=center>
<tr>
	<td><a href="index.php?op=info&action=phpinfo">服务器信息</a>&nbsp;&nbsp;<a href="index.php?op=info&action=mysql_vars">MySQL参数</a>&nbsp;&nbsp;<a href="index.php?op=info&action=mysql_status">MySQL状态</a></td>
</tr>
</table>
<hr>
<?php
if($action == "phpinfo") {
	phpinfo();
}
else if($action == "mysql_vars") {
	$result = $db->query('SHOW VARIABLES');
	?><table align=center><tr><td colspan=2 align=center><b>MySQL参数：</b></td></tr><?php
	while($value = $db->fetch_array($result))
	{
		?><tr>
			<td><?=$value[Variable_name]?></td>
			<td><?=$value[Value]?></td>
		</tr><?php
	}
	?></table><?php
}
else if($action == "mysql_status") {
	$result = $db->query('SHOW STATUS');
	?><table align=center><tr><td colspan=2 align=center><b>MySQL状态：</b></td></tr><?php
	while($value = $db->fetch_array($result))
	{
		?><tr>
			<td><?=$value[Variable_name]?></td>
			<td><?=$value[Value]?></td>
		</tr><?php
	}
	?></table><?php
}
else
{
	$serverinfo = PHP_OS.' / PHP v'.PHP_VERSION;
	$serverinfo .= @ini_get('safe_mode') ? ' 安全模式' : NULL;
	if(WH_DB_USER != ""){
		$dbversion = $db->result($db->query("SELECT VERSION()"), 0);
	}

	if(@ini_get("file_uploads")) {
		$fileupload = "允许 - 文件 ".ini_get("upload_max_filesize")." - 表单：".ini_get("post_max_size");
	} else {
		$fileupload = "<font color=\"red\">禁止</font>";
	}

	$disk_free_space = $WHuds->size(disk_free_space("/")); 
	$disk_total_space = $WHuds->size(disk_total_space("/")); 

?>
<table align=center>
<tr>
	<td>服务器环境:</td>
	<td><?=$serverinfo?></td>
</tr>
<tr>
	<td>MySQL 版本:</td>
	<td><?=$dbversion?></td>
</tr>
<tr>
	<td>附件上传许可:</td>
	<td><?=$fileupload?></td>
</tr>
<tr>
	<td>空间使用:</td>
	<td>总空间：<?=$disk_total_space?>－剩余空间：<?=$disk_free_space?></td>
</tr>
</table>
<?php
}

?>