<?php
header("Content-type: text/html;charset=utf8");
?>
<html>
<head>

<style>
body,html{margin:0px;background:#f8f8f8;padding:0px;font-size:17px;letter-spacing:1px;}
txt{color:blue;font-weight:bold}
back{color:red}
</style>
<title>安装环境检测</title>
</head>
</body>
<?php
$version = PHP_VERSION;
$versionback = FALSE;
$versiontxt = '不适合';
if ($version >= '5.2.0') 
{
    $versionback = TRUE;
    $versiontxt = '通过';
}
/*服务器检查*/
$hostip = GetHostByName($_SERVER['SERVER_NAME']);
$encode = MD5($hostip . '_' . date('YmdHi'));
file_put_contents('../temp/temp_encode.txt', $encode);
$hostipback = FALSE;
$hostiptxt = '共享IP';
if(is_file('../temp/temp_encode.txt')){
	if (file_get_contents('http://' . $hostip . '/temp/temp_encode.txt') == $encode) 
	{
		$hostipback = TRUE;
		$hostiptxt = '独立IP';
	}
}
/*端口检测*/
$port = $_SERVER['SERVER_PORT'];
$portback = FALSE;
$porttxt = '未通过';
if ($port == '80') {
    $portback = TRUE;
    $porttxt = '通过';
}

/*GD库检测*/
$GD = FALSE;
$GDT = '不支持';
if(function_exists('imagecreate'))
{
	$GD = TRUE;
	$GDT = '支持';
};

echo "<div class=\"title\" style=\"line-height:40px;text-align:center;color:#328cc9;background-color:#efefef;\"><b>平台检测</b></div>";
echo "<br><txt>PHP本版</txt>: $version (要求最低5.2.0 <back> $versiontxt </back> )<hr>";
echo "<txt>服务器IP</txt>: $hostip (要求独立IP 当前 <back> $hostiptxt </back> )<hr>";
echo "[PS:共享IP只能做单用户网站，不能做多用户平台!]<hr>";
echo "<txt>端口</txt>: $port (要求80端口 <back> $porttxt </back> )<hr>";
echo "<txt>是否支持GD库</txt>: $GDT <hr>";
if ($versionback == TRUE && $portback == TRUE && $GD) 
{
    echo '<a href="index.php">[通过检测 进入下一步]</a>';
} else {
    echo '[未通过检测 无法安装本系统]';
}
?>
</body></html> 