<link rel="stylesheet" type="text/css" href="images/hait_admin.css" />
<?php require ("Hait_login_ask.php");?>
<?php

class ServerInfo
{//类定义开始

    
    public function GetServerTime()
    {
        return date('Y-m-d　H:i:s');
    }

    
    public function GetServerSoftwares()
    {
        return $_SERVER['SERVER_SOFTWARE'];
    }

    
    public function GetPhpVersion()
    {
        return PHP_VERSION;
    }

    
    public function GetMysqlVersion()
    {
        return mysql_get_server_info();
    }

    
    public function GetHttpVersion()
    {
        return $_SERVER['SERVER_PROTOCOL'];
    }

    
    public function GetDocumentRoot()
    {
        return $_SERVER['DOCUMENT_ROOT'];
    }

    
    public function GetMaxExecutionTime()
    {
        return ini_get('max_execution_time').' Seconds';
    }

    
    public function GetServerFileUpload()
    {
        if (@ini_get('file_uploads')) {
            return '允许 '.ini_get('upload_max_filesize');
        } else {
            return '<font color="red">禁止</font>';
        }
    }

    
    public function GetRegisterGlobals()
    {
        return $this->GetPhpCfg('register_globals');
    }

    
    public function GetSafeMode()
    {
        return $this->GetPhpCfg('safe_mode');
    }

    
    public function GetGdVersion()
    {
        if(function_exists('gd_info')){
            $GDArray = gd_info();
            $gd_version_number = $GDArray['GD Version'] ? '版本：'.$GDArray['GD Version'] : '不支持';
        }else{
            $gd_version_number = '不支持';
        }
        return $gd_version_number;
    }

    
    public function GetMemoryUsage()
    {
        return $this->ConversionDataUnit(memory_get_usage());
    }

    
    private function ConversionDataUnit($size)
    {
        $kb = 1024;       // Kilobyte
        $mb = 1024 * $kb; // Megabyte
        $gb = 1024 * $mb; // Gigabyte
        $tb = 1024 * $gb; // Terabyte
        //round() 对浮点数进行四舍五入
        if($size < $kb) {
            return $size.' Byte';
        }
        else if($size < $mb) {
            return round($size/$kb,2).' KB';
        }
        else if($size < $gb) {
            return round($size/$mb,2).' MB';
        }
        else if($size < $tb) {
            return round($size/$gb,2).' GB';
        }
        else {
            return round($size/$tb,2).' TB';
        }
    }

    
    private function GetPhpCfg($val)
    {
        switch($result = get_cfg_var($val)) {
        case 0:
            return '关闭';
            break;
        case 1:
            return '打开';
            break;
        default:
            return $result;
            break;
        }
    }

}//类定义结束
date_default_timezone_set('PRC');
$ServerInfo = new ServerInfo();
?>
<table align="left" width="100%" cellpadding="4" cellspacing="1"  bgcolor="#C0C0C0" >
     <tr bgcolor="#DFEFFF">
       <td height="18" colspan="4" align="left" valign="middle"  background="images/bg2.gif" bgcolor="#DFEFFF" class="STYLE6" >
         <table border="0">
           <tr>
             <td valign="bottom"><img src="images/cog.png" /></td>
             <td valign="bottom" ><span class="STYLE6">您现在的位置：后台首页</span></td>
           </tr>
         </table></td>
  </tr>
     <tr bgcolor="#DFEFFF">
       <td colspan="4" align="center" bgcolor="#000000"><a href="http://www.yiniba.com"><img src="images/hait_windows.png" border="0" /></a></td>
     </tr>
     
     <tr bgcolor="#DFEFFF">
       <td colspan="4" align="left" bgcolor="#FFFFFF" class="STYLE6"><img src="images/house.png" />&nbsp;服务器信息</td>
     </tr>
     <tr bgcolor="#DFEFFF">
       <td width="10%" align="right" bgcolor="#FFFFFF" class="STYLE6">服务器时间：</td>
       <td bgcolor="#FFFFFF" class="STYLE3"><?php echo $ServerInfo->GetServerTime();?></td>
       <td width="10%" align="right" bgcolor="#FFFFFF" class="STYLE6">内存占用：</td>
       <td bgcolor="#FFFFFF" class="STYLE3"><?php echo $ServerInfo->GetMemoryUsage();?> </td>
     </tr>
     <tr bgcolor="#DFEFFF" align="left">
       <td align="right" bgcolor="#FFFFFF" class="STYLE6">服务器解译引擎：</td>
       <td bgcolor="#FFFFFF" class="STYLE3"><?php echo $ServerInfo->GetServerSoftwares();?></td>
       <td align="right" bgcolor="#FFFFFF" class="STYLE6">网站根目录：</td>
       <td bgcolor="#FFFFFF" class="STYLE3"><?php echo $ServerInfo->GetDocumentRoot();?></td>
     </tr>
     <tr bgcolor="#DFEFFF" align="left">
       <td align="right" bgcolor="#FFFFFF" class="STYLE6">HTTP版本：</td>
       <td bgcolor="#FFFFFF" class="STYLE3"><?php echo $ServerInfo->GetHttpVersion();?></td>
       <td align="right" bgcolor="#FFFFFF" class="STYLE6">最大执行时间：</td>
       <td bgcolor="#FFFFFF" class="STYLE3"><?php echo $ServerInfo->GetMaxExecutionTime();?></td>
     </tr>
     <tr bgcolor="#DFEFFF">
       <td align="right" bgcolor="#FFFFFF" class="STYLE6">PHP版本：</td>
       <td bgcolor="#FFFFFF" class="STYLE3"><?php echo $ServerInfo->GetPhpVersion();?></td>
       <td align="right" bgcolor="#FFFFFF" class="STYLE6">文件上传：</td>
       <td bgcolor="#FFFFFF" class="STYLE3"><?php echo $ServerInfo->GetServerFileUpload();?></td>
     </tr>
     <tr bgcolor="#DFEFFF">
       <td align="right" bgcolor="#FFFFFF" class="STYLE6">全局变量：</td>
       <td bgcolor="#FFFFFF" class="STYLE3"><?php echo $ServerInfo->GetRegisterGlobals();?></td>
       <td align="right" bgcolor="#FFFFFF" class="STYLE6">图形处理：</td>
       <td bgcolor="#FFFFFF" class="STYLE3"><?php echo $ServerInfo->GetGdVersion();?></td>
     </tr>
     <tr bgcolor="#DFEFFF">
       <td align="right" bgcolor="#FFFFFF" class="STYLE6">安全模式：</td>
       <td bgcolor="#FFFFFF" class="STYLE3"><?php echo $ServerInfo->GetSafeMode();?></td>
       <td align="right" bgcolor="#FFFFFF" class="STYLE6">&nbsp;</td>
       <td bgcolor="#FFFFFF" class="STYLE3">&nbsp;</td>
     </tr>
	 <tr>
	   <td colspan="4" align="left" bgcolor="#FFFFFF"><span class="STYLE6"><img src="images/house.png" />&nbsp;官方信息（请不要删除下面内容，以便及时为你提供Hait-windows的最新信息）</span></td>
  </tr>
	 <tr><td colspan="4" align="left" bgcolor="#FFFFFF"><iframe src="http://www.yiniba.com/hait_windows_xx.php" width="100%" height="100" frameborder="0" scrolling="No"  ></iframe></td></tr>
 </table>
