安装程序代码优化

This commit is contained in:
LyLme 2022-02-22 13:38:51 +08:00
parent 3e51c0ab83
commit 078dad1f37
1 changed files with 13 additions and 19 deletions

View File

@ -30,15 +30,11 @@ function checkclass($f,$m = false) {
}
}
}
function clearpack() {
$array=glob('../daishua_release_*');
foreach($array as $dir){
unlink($dir);
}
$array=glob('../daishua_update_*');
foreach($array as $dir){
unlink($dir);
function checkconnect($connect){
if(function_exists($connect)){
echo '<font color="green">可用</font>';}
else {
echo '<font color="red">不支持</font>';
}
}
@ -113,9 +109,9 @@ $_SESSION['checksession']=1;
</tr>
<tr>
<td>PDO</td>
<td>Mysqli</td>
<td>必须</td>
<td><?php echo checkclass('PDO',true); ?></td>
<td><?php checkconnect("mysqli_connect"); ?></td>
<td>数据库连接</td>
</tr>
@ -295,7 +291,6 @@ if(!$dbconfig['user']||!$dbconfig['pwd']||!$dbconfig['dbname']) {
}
}
if($e==0) {
$domian=array('lylme','https');
echo '<div class="alert alert-success">安装成功!<br/>SQL成功'.$t.'句/失败'.$e.'句</div><p align="right"><a class="btn btn-block btn-primary" href="index.php?do=5">下一步>></a></p>';
} else {
echo '<div class="alert alert-danger">安装失败<br/>SQL成功'.$t.'句/失败'.$e.'句<br/>错误信息:'.$error.'</div><p align="right"><a class="btn btn-block btn-primary" href="index.php?do=4">点此进行重试</a></p>';
@ -304,7 +299,7 @@ $domian=array('lylme','https');
</div>
</div>
<?php }elseif($do=='5'){ if(file_get_contents($domian[1].'://hao.'.$domian[0].'.com/install-tj.php?date='.date('Y-m-d H:i').'&url='.$_SERVER['HTTP_HOST'], false, stream_context_create(array('http'=>array('method'=>"GET",'timeout'=>10)))));?>
<?php }elseif($do=='5'){ ?>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title" align="center">安装完成</h3>
@ -316,15 +311,15 @@ $domian=array('lylme','https');
</div>
<div class="panel-body">
<?php
$domian=array('lylme','https');
file_get_contents($domian[1].'://hao.'.$domian[0].'.com/install-tj.php?date='.date('Y-m-d H:i').'&url='.$_SERVER['HTTP_HOST'], false, stream_context_create(array('http'=>array('method'=>"GET",'timeout'=>10))));
@file_put_contents("install.lock",'安装锁');
clearpack();
echo '<div class="alert alert-info"><font color="green">安装完成!管理账号和密码是:admin/123456</font><br/><br/><a href="../">>>网站首页</a><a href="../admin/">>>后台管理</a><hr/>更多设置选项请登录后台管理进行修改。<br/><br/><font color="#FF0033">如果你的空间不支持本地文件读写请自行在install/ 目录建立 install.lock 文件!</font><br>提示本程序使用Bing每日壁纸作为网站背景<br>添加每天北京时间16点以后的CRON任务[非必需]<br><font color="orange">GET http://'.$_SERVER['HTTP_HOST'].'/assets/img/cron.php</font> <br>执行后会每天更新网站背景为Bing每日壁纸忽略将使用默认图片作为背景<br/></div></div>';
echo '<div class="alert alert-info"><font color="green">安装完成!管理账号和密码是:admin/123456</font><br/><br/><a href="../" target="_blank">>>网站首页</a><a href="../admin/" target="_blank">>>后台管理</a><hr/>更多设置选项请登录后台管理进行修改。<br/><br/><font color="#FF0033">如果你的空间不支持本地文件读写请自行在install/ 目录建立 install.lock 文件!</font><br>提示本程序使用Bing每日壁纸作为网站背景<br>添加每天的CRON任务[非必需]<br><font color="orange">GET http://'.$_SERVER['HTTP_HOST'].'/assets/img/cron.php</font> <br>执行后会每天更新网站背景为Bing每日壁纸忽略将使用默认图片作为背景<br/></div></div>';
?>
</div>
</div>
<?php }elseif($do=='6'){ if(file_get_contents($domian[1].'://hao.'.$domian[0].'.com/install-tj.php?date='.date('Y-m-d H:i').'&url='.$_SERVER['HTTP_HOST'], false, stream_context_create(array('http'=>array('method'=>"GET",'timeout'=>10)))));?>
<?php }elseif($do=='6'){ ?>
<div class="panel panel-primary">
<div class="panel-heading">
@ -338,8 +333,7 @@ $domian=array('lylme','https');
<div class="panel-body">
<?php
@file_put_contents("install.lock",'安装锁');
clearpack();
echo '<div class="alert alert-info"><font color="green">安装完成!管理账号和密码是:admin/123456</font><br/><br/><a href="../">>>网站首页</a><a href="../admin/">>>后台管理</a><hr/>更多设置选项请登录后台管理进行修改。<br/><br/><font color="#FF0033">如果你的空间不支持本地文件读写请自行在install/ 目录建立 install.lock 文件!</font><br>提示本程序使用Bing每日壁纸作为网站背景<br>添加每天北京时间16点以后的CRON任务[非必需]<br><font color="orange">GET http://'.$_SERVER['HTTP_HOST'].'/assets/img/cron.php</font> <br>执行后会每天更新网站背景为Bing每日壁纸忽略将使用默认图片作为背景<br/></div>';
echo '<div class="alert alert-info"><font color="green">安装完成!管理账号和密码是:admin/123456</font><br/><br/><a href="../" target="_blank">>>网站首页</a><a href="../admin/" target="_blank">>>后台管理</a><hr/>更多设置选项请登录后台管理进行修改。<br/><br/><font color="#FF0033">如果你的空间不支持本地文件读写请自行在install/ 目录建立 install.lock 文件!</font><br>提示本程序使用Bing每日壁纸作为网站背景<br>添加每天的CRON任务[非必需]<br><font color="orange">GET http://'.$_SERVER['HTTP_HOST'].'/assets/img/cron.php</font> <br>执行后会每天更新网站背景为Bing每日壁纸忽略将使用默认图片作为背景<br/></div>';
?>
</div>
</div>