File: /www/wwwroot/bs.kntsleep.com/install/html/check.html
<section class="check bosscms">
<div class="space">
<div class="step">
<ul>
<li class="on">检测安装环境</li>
<li>配置数据库</li>
<li>完成安装</li>
</ul>
</div>
</div>
<?php
$check=true;
if(PHP_VERSION>=5.6){
$versions='fa-check';
}else{
$versions='fa-times';
$check=false;
}
if(function_exists("mysqli_connect")){
$mysqli='fa-check';
}else{
$mysqli='fa-times';
$check=false;
}
if(class_exists("ZipArchive")){
$zipar='fa-check';
}else{
$zipar='fa-times';
$check=false;
}
if(function_exists("curl_init")){
$curlr='fa-check';
}else{
$curlr='fa-times';
$check=false;
}
if(function_exists("gd_info")){
$gdr='fa-check';
}else{
$gdr='fa-times';
$check=false;
}
?>
<div class="server table <?php echo $check?'':'on'; ?>">
<h2>
<i class="fa <?php echo $check?'fa-check':'fa-times'; ?>"></i>
<b>服务器检测</b>
<u class="fa fa-angle-down"></u>
</h2>
<table>
<tbody>
<tr>
<th>环境名称</th>
<th>环境参数</th>
<th>支持/不支持</th>
</tr>
<tr>
<td>运行平台</td>
<td><?php echo $_SERVER["SERVER_SOFTWARE"]; ?></td>
<td><em class="fa fa-check"></em></td>
</tr>
<tr>
<td>PHP版本</td>
<td><?php echo PHP_VERSION; ?></td>
<td><em class="fa <?php echo $versions; ?>"></em></td>
</tr>
<tr>
<td>MYSQLi扩展</td>
<td><?php echo $mysqli=='fa-check'?'已开启':'未开启'; ?></td>
<td><em class="fa <?php echo $mysqli; ?>"></em></td>
</tr>
<tr>
<td>ZIP扩展</td>
<td><?php echo $zipar=='fa-check'?'已开启':'未开启'; ?></td>
<td><em class="fa <?php echo $zipar; ?>"></em></td>
</tr>
<tr>
<td>cURL扩展</td>
<td><?php echo $curlr=='fa-check'?'已开启':'未开启'; ?></td>
<td><em class="fa <?php echo $curlr; ?>"></em></td>
</tr>
<tr>
<td>GD库扩展</td>
<td><?php echo $gdr=='fa-check'?'已开启':'未开启'; ?></td>
<td><em class="fa <?php echo $gdr; ?>"></em></td>
</tr>
</tbody>
</table>
</div>
<?php
$check=true;
$arr = array(
'/' => '../',
'/cache/' => '../cache/',
'/upload/' => '../upload/',
'/system/' => '../system/',
'/system/backup/' => '../system/backup/',
'/system/extend/' => '../system/extend/',
'/system/plugin/' => '../system/plugin/',
'/system/web/theme/' => '../system/web/theme/'
);
$res = array();
foreach($arr as $k=>$v){
$fa = '<em class="fa fa-times"></em>';
$txt = '';
if(!is_dir($v)){
mkdir($v);
}
if(is_dir($v)){
$file = $v.'install.'.time().'.check.txt';
@file_put_contents($file, 'ok');
if(is_file($file)){
$txt = '只可写';
if(file_get_contents($file) == 'ok'){
$txt = '可读写';
$fa = '<em class="fa fa-check"></em>';
}
unlink($file);
}else if(is_readable($v)){
$txt = '只可读';
}else{
$txt = '不可读写';
}
}else{
$txt = '<span>文件夹不存在</span>';
}
$res[] = array($k, $txt, $fa);
if(strstr($fa,'fa-times')){
$check=false;
}
}
$ini = '../system/basic/ini/mysql.ini.php';
$txt = '';
if(!is_file($ini)){
@file_put_contents($ini, '');
if(!is_file($ini)){
$txt = '文件不存在';
}
}
if(!$txt){
$time = time();
$con = file_get_contents($ini);
@file_put_contents($ini, $time);
if(file_get_contents($ini) == $time){
@file_put_contents($ini, $con);
}else{
$txt = '文件不可写';
}
}
if($txt){
$check=false;
$res[] = array(
'system/basic/ini/mysql.ini.php',
$txt,
'<em class="fa fa-times"></em>'
);
}
?>
<div class="folder table <?php echo $check?'':'on'; ?>">
<h2>
<i class="fa <?php echo $check?'fa-check':'fa-times'; ?>"></i>
<b>目录权限检测</b>
<u class="fa fa-angle-down"></u>
</h2>
<table>
<tbody>
<tr>
<th>目录名称</th>
<th>目录权限</th>
<th>支持/不支持</th>
</tr>
<?php foreach($res as $v){ ?>
<tr>
<td><?php echo $v[0]; ?></td>
<td><?php echo $v[1]; ?></td>
<td><?php echo $v[2]; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="next">
<a class="up" href="./">上一步</a>
<?php if($check){ ?>
<a class="down" href="?page=database">下一步</a>
<?php }else{ ?>
<a class="down" hide href="?page=check">重新检测</a>
<?php } ?>
</div>
</section>