From 6b13808ad8661f0ad6c54cc4fdf49d021102cdb2 Mon Sep 17 00:00:00 2001 From: merelendor Date: Mon, 16 Sep 2024 17:34:25 +0300 Subject: [PATCH] move ORIGINS to dbconn.php array --- api/index.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/api/index.php b/api/index.php index 39141a7..aaba792 100644 --- a/api/index.php +++ b/api/index.php @@ -21,21 +21,10 @@ $HEADERS = apache_request_headers(); $METHOD = $_SERVER['REQUEST_METHOD']; $REQ = []; -$ORIGINS = [ - 'http://localhost:3000', - 'https://evo.quickcode.ru', - 'https://lk-evo.quickcode.ru', - 'https://wow.evoleasing.ru', - 'https://www.evoleasing.ru', - 'https://evoleasing.ru', - 'http://lk.evoleasing.ru', - 'https://lk.evoleasing.ru', -]; - $origin = isset($HEADERS['Origin']) ? $HEADERS['Origin'] : (isset($HEADERS['origin']) ? $HEADERS['origin'] : preg_replace(["/([^A-z.]+)/"], [""], isset($HEADERS['Host']) ? $HEADERS['Host'] : $HEADERS['host'])); if($origin == "") { - foreach($ORIGINS as $ORIGIN) + foreach(ORIGINS as $ORIGIN) { if(strpos($HEADERS['referer'], $ORIGIN) !== FALSE) { @@ -45,7 +34,7 @@ if($origin == "") } } -if(in_array($origin, $ORIGINS)) +if(in_array($origin, ORIGINS)) { header('Access-Control-Allow-Origin: ' . $origin); }