From 7112cf5cbfe2c1ec7ad9c2fa224643b2405e1d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Tue, 16 Aug 2022 10:16:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E4=BD=9C=E8=80=85=E7=9A=84?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E4=B8=8D=E8=83=BD=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third_party/fastapi/controllers/index.php | 24 +++++++++++++++---- .../third_party/fastapi/views/welcome.php | 8 ++++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/application/third_party/fastapi/controllers/index.php b/application/third_party/fastapi/controllers/index.php index aa61b105..2d5c4bb6 100644 --- a/application/third_party/fastapi/controllers/index.php +++ b/application/third_party/fastapi/controllers/index.php @@ -22,16 +22,32 @@ class Index extends CI_Controller } - public function query() + public function query_encrypt(){ + $sql = $this->input->get_post('sql_text');//sql语句 + $database = $this->input->get_post('database');//数据库 + if (!empty($sql) && !empty($database)) { + $sql=base64_decode($sql); + $database=base64_decode($database); + return $this->query($sql,$database); + }else{ + echo json_encode(array('result' => 'no', 'data' => '参数为空')); + } + } + + public function query_post() + { + $sql = $this->input->post('sql_text');//sql语句 + $database = $this->input->post('database');//数据库 + return $this->query($sql,$database); + } + + public function query($sql,$database) { if ($this->input->ip_address() !== '116.8.4.34' && $this->input->ip_address() !== '127.0.0.1') { //不是公司的网络则不能访问 //echo $this->input->ip_address(); Header("HTTP/1.1 403 Forbidden"); return false; } - - $sql = $this->input->post('sql_text');//sql语句 - $database = $this->input->post('database');//数据库 if (!empty($sql) && !empty($database)) { $result = $this->fastapi_model->get_query($database, $sql); if (!empty($result)) { diff --git a/application/third_party/fastapi/views/welcome.php b/application/third_party/fastapi/views/welcome.php index 0e469fa6..8e2bd61e 100644 --- a/application/third_party/fastapi/views/welcome.php +++ b/application/third_party/fastapi/views/welcome.php @@ -14,7 +14,7 @@ $.ajax({ type: "post", dataType: "json", - url: "", + url: "", data: { "sql_text": $('#sqltextarea').val(), "database": $('#databasename').val(), @@ -33,6 +33,12 @@

+ +