From 00a9cbf1292cbb1f78b4e530b765dede9b183ca3 Mon Sep 17 00:00:00 2001 From: zhao Date: Sun, 9 Feb 2020 12:19:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=AE=89=E8=A3=85=E5=BC=95?= =?UTF-8?q?=E5=AF=BC=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/install/controller/Index.php | 28 ++++++------ app/install/controller/Success.php | 14 ++++++ public/index.php | 3 ++ public/install.php | 24 ++++++++++ view/install/index/agreement.html | 2 +- view/install/index/create.html | 44 +++++++++++++++++-- view/install/index/test.html | 4 +- view/install/{index => success}/complete.html | 0 8 files changed, 100 insertions(+), 19 deletions(-) create mode 100644 app/install/controller/Success.php create mode 100644 public/install.php rename view/install/{index => success}/complete.html (100%) diff --git a/app/install/controller/Index.php b/app/install/controller/Index.php index a5df831..15b0094 100644 --- a/app/install/controller/Index.php +++ b/app/install/controller/Index.php @@ -14,7 +14,7 @@ class Index extends BaseController */ // 检测是否安装过 protected function initialize(){ - if(is_file('../install.lock')){ + if(file_exists('../install.lock')){ echo ""; die(); } @@ -38,7 +38,7 @@ class Index extends BaseController } } - //test + //create public function create(){ if(Session::get('install') == 2){ Session::set('install',3); @@ -48,17 +48,18 @@ class Index extends BaseController } } - // 安装成功页面 - public function complete(){ + // 安装 + public function install(){ - if(Session::get('install') != 3){ - return redirect('./create.html'); - } + //if(Session::get('install') != 3){ + // return redirect('./create.html'); + //} // 判断是否为post - if ($_SERVER['REQUEST_METHOD'] == 'POST') { - - $data = $_POST; + //if ($_SERVER['REQUEST_METHOD'] == 'POST') { + if(Request::isAjax()){ + $data = Request::param(); + //$data = $_POST; //var_dump($data); if (!preg_match("/^[a-zA-Z]{1}([0-9a-zA-Z]|[._]){4,19}$/", $data['admin_user'])) { die(""); @@ -194,10 +195,11 @@ php; //安装上锁 file_put_contents('../install.lock', 'lock'); Session::clear(); - return View::fetch('complete'); + //return View::fetch('complete'); + return json(['code' => 0,'msg'=>'安装成功','url'=>'/install.php/success/complete']); } else { - return '安装失败'; - } + return '请求失败!'; + } } } \ No newline at end of file diff --git a/app/install/controller/Success.php b/app/install/controller/Success.php new file mode 100644 index 0000000..998ceab --- /dev/null +++ b/app/install/controller/Success.php @@ -0,0 +1,14 @@ +run(); $response->send(); $http->end($response); +if(file_exists('../install.lock') != 'true'){ + header('Location: http://www.tp6.com/install.php'); +} \ No newline at end of file diff --git a/public/install.php b/public/install.php new file mode 100644 index 0000000..31fa17a --- /dev/null +++ b/public/install.php @@ -0,0 +1,24 @@ + +// +---------------------------------------------------------------------- + +// [ 应用入口文件 ] +namespace think; + +require __DIR__ . '/../vendor/autoload.php'; + +// 执行HTTP应用并响应 +$http = (new App())->http; + +$response = $http->run(); + +$response->send(); + +$http->end($response); \ No newline at end of file diff --git a/view/install/index/agreement.html b/view/install/index/agreement.html index b54ad14..cd70111 100644 --- a/view/install/index/agreement.html +++ b/view/install/index/agreement.html @@ -18,7 +18,7 @@ 拒绝安装
- 同意安装 + 同意安装

diff --git a/view/install/index/create.html b/view/install/index/create.html index d2ab97a..b5da1f7 100644 --- a/view/install/index/create.html +++ b/view/install/index/create.html @@ -3,7 +3,7 @@ {block name="body"}
-
+

创建数据库:

@@ -85,7 +85,7 @@
- 上一步 + 上一步
@@ -93,7 +93,45 @@
diff --git a/view/install/index/test.html b/view/install/index/test.html index 9da90fe..b90f951 100644 --- a/view/install/index/test.html +++ b/view/install/index/test.html @@ -85,7 +85,7 @@
- 上一步 + 上一步
下一步 @@ -97,7 +97,7 @@ if ($('.yes').length != 5) { alert('您的配置或权限不符合要求'); } else { - location.href = '{:url('install/index/create')}'; + location.href = '{:url('/index/create')}'; } } diff --git a/view/install/index/complete.html b/view/install/success/complete.html similarity index 100% rename from view/install/index/complete.html rename to view/install/success/complete.html