From 42eff5e0fa80f320774a0bb7ba0093ff45ab6ee2 Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Thu, 15 Jun 2023 18:49:31 -0500 Subject: [PATCH] Added code to redirect the user to a different page if the GLink they requested is geo-restricted --- redirect.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/redirect.php b/redirect.php index 999bdaa..d5b3a5d 100644 --- a/redirect.php +++ b/redirect.php @@ -15,7 +15,7 @@ $keyspace = 'glink'; $session = $cluster->connect($keyspace); - $statement = $session->prepare('SELECT url FROM data WHERE shortlink=? ALLOW FILTERING;'); + $statement = $session->prepare('SELECT url,is_geo FROM data WHERE shortlink=? ALLOW FILTERING;'); $result = $session->execute($statement,array('arguments' => array($uri))); if ($result->count() == 0) { @@ -28,7 +28,13 @@ printf('The given GLink was invalid, and doesn\'t point to a specific web page.'); exit; } else { - header("Location: " . $row['url']); + if ($row['is_geo'] == true) { + header("Location: https://glink.zip/reqloc.html"); + exit; + } else { + header("Location: " . $row['url']); + exit; + } } } }