EasyImages2.0/install/contorl.php

56 lines
1.5 KiB
PHP
Raw Normal View History

2021-11-09 03:43:23 +00:00
<?php
require_once __DIR__ . '/../application/function.php';
if (file_exists(APP_ROOT . '/install/install.lock')) {
exit(header("Location:/../index.php"));
}
if (isset($_POST['password'])) {
if ($_POST['password'] == $_POST['repassword']) {
2022-01-05 10:41:45 +00:00
$config['password'] = md5($_POST['password']);
2021-11-09 03:43:23 +00:00
} else {
exit('<script>window.alert("两次密码不一致请重新输入!");location.href="./index.php";</script>');
}
}
if (isset($_POST['domain'])) {
2022-01-05 10:41:45 +00:00
$config['domain'] = $_POST['domain'];
2021-11-09 03:43:23 +00:00
}
if (isset($_POST['imgurl'])) {
2022-01-05 10:41:45 +00:00
$config['imgurl'] = $_POST['imgurl'];
2021-11-09 03:43:23 +00:00
}
$config_file = APP_ROOT . '/config/config.php';
cache_write($config_file, $config);
file_put_contents(APP_ROOT . '/install/install.lock', '安装程序锁定文件。'); // 创建安装程序锁
// 跳转主页
echo '
<script>
window.alert("安装成功,即将为您跳转到登陆界面!");
2022-01-05 10:41:45 +00:00
location.href="' . get_whole_url('/install/contorl.php') . '/application/login.php' . '";
2021-11-09 03:43:23 +00:00
</script>
';
// 删除安装目录
if (isset($_POST['del_install'])) {
if ($_POST['del_install'] == "del") {
deldir(APP_ROOT . "/install/");
}
}
2022-01-17 08:39:59 +00:00
// 删除多余文件
if (isset($_POST['del_extra_files'])) {
if ($_POST['del_extra_files'] == "del") {
@unlink(APP_ROOT . '/CODE_OF_CONDUCT.md');
@unlink(APP_ROOT . '/LICENSE');
@unlink(APP_ROOT . '/README.md');
@unlink(APP_ROOT . '/config/EasyIamge.lock');
@deldir(APP_ROOT . "/.github/");
}
}
2021-11-09 03:43:23 +00:00
//exit(header("Location:/../application/login.php")); // 跳转主页