|
|
|
@ -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)) {
|
|
|
|
|