From 5416bdaa5c5068e3be5e03b7b5c53a4d8b15af4c Mon Sep 17 00:00:00 2001 From: lyt Date: Tue, 21 Jan 2020 10:26:47 +0800 Subject: [PATCH] author.php allow origin-cht.mycht.cn --- author/controllers/login.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/author/controllers/login.php b/author/controllers/login.php index 5d67caf1..34776cb9 100644 --- a/author/controllers/login.php +++ b/author/controllers/login.php @@ -8,6 +8,18 @@ class Login extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('Infoauthors_model'); + if (isset($_SERVER['HTTP_ORIGIN'])) { + $http_origin = $_SERVER['HTTP_ORIGIN']; + $allowed_domains = array( + 'https://cht.mycht.cn', + 'https://origin-cht.mycht.cn' + ); + + if (in_array($http_origin, $allowed_domains)) + { + header("Access-Control-Allow-Origin: $http_origin"); + } + } } public function index() { @@ -229,4 +241,4 @@ class Login extends CI_Controller { } /* End of file welcome.php */ -/* Location: ./application/controllers/welcome.php */ \ No newline at end of file +/* Location: ./application/controllers/welcome.php */