Skip to content

Commit

Permalink
Block Cathay Pacific access to API #1447
Browse files Browse the repository at this point in the history
  • Loading branch information
jpatokal committed Nov 18, 2023
1 parent a569d94 commit 6dec7d0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion php/apsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@
$action = $_POST["action"];
$apid = $_POST["apid"];

$uid = $_SESSION["uid"] ?? null;

This comment has been minimized.

Copy link
@reedy

reedy Nov 18, 2023

Collaborator

Don't think this line should've been removed, $uid is used down on line 40 (after this patch)

This comment has been minimized.

Copy link
@reedy

reedy Nov 18, 2023

Collaborator

Fixed in db2008f

This comment has been minimized.

Copy link
@jpatokal

jpatokal Nov 19, 2023

Author Owner

Crud, how'd I mess that up? Thanks for catching & fixing.

// 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 [email protected] to resolve this."]
)
);
}

if ($action == "RECORD") {
if (!$uid || empty($uid)) {
Expand Down

0 comments on commit 6dec7d0

Please sign in to comment.