From 6dec7d05da1a9ea18777275b349623482ef6fabc Mon Sep 17 00:00:00 2001 From: Jani Patokallio Date: Sat, 18 Nov 2023 11:47:12 +0000 Subject: [PATCH] Block Cathay Pacific access to API #1447 --- php/apsearch.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/php/apsearch.php b/php/apsearch.php index 214bdc7e..b7290176 100644 --- a/php/apsearch.php +++ b/php/apsearch.php @@ -26,7 +26,15 @@ $action = $_POST["action"]; $apid = $_POST["apid"]; -$uid = $_SESSION["uid"] ?? null; +// https://github.com/jpatokal/openflights/issues/1447 +$ref = $_SERVER['HTTP_REFERER']; +if (strpos($ref, 'com.cathaypacific.iJourneyLite') !== FALSE) { + die( + json_encode( + ["status" => 0, "message" => "Cathay Pacific iJourneyLite is not licensed to use this API. Please contact info@openflights.org to resolve this."] + ) + ); +} if ($action == "RECORD") { if (!$uid || empty($uid)) {