Added code to redirect the user to a different page if the GLink they requested is geo-restricted
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
$keyspace = 'glink';
|
$keyspace = 'glink';
|
||||||
$session = $cluster->connect($keyspace);
|
$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)));
|
$result = $session->execute($statement,array('arguments' => array($uri)));
|
||||||
|
|
||||||
if ($result->count() == 0) {
|
if ($result->count() == 0) {
|
||||||
@@ -27,8 +27,14 @@
|
|||||||
if (is_null($row)) {
|
if (is_null($row)) {
|
||||||
printf('The given GLink was invalid, and doesn\'t point to a specific web page.');
|
printf('The given GLink was invalid, and doesn\'t point to a specific web page.');
|
||||||
exit;
|
exit;
|
||||||
|
} else {
|
||||||
|
if ($row['is_geo'] == true) {
|
||||||
|
header("Location: https://glink.zip/reqloc.html");
|
||||||
|
exit;
|
||||||
} else {
|
} else {
|
||||||
header("Location: " . $row['url']);
|
header("Location: " . $row['url']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user