From 5d41d3adb8d7f5bacd46915bb90d4239f1ad5376 Mon Sep 17 00:00:00 2001 From: alopexc0de Date: Sun, 10 Aug 2014 18:46:39 -0400 Subject: [PATCH] Grab links from list and start redirecting again. get links:id doesn't work since I moved it into a list. That break doesn't do anything, removing it. --- Website/index.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Website/index.php b/Website/index.php index 4e8b9de..b975113 100644 --- a/Website/index.php +++ b/Website/index.php @@ -45,14 +45,13 @@ }else{ if($trTtl == -2){ // The link has been deleted, no need to track it anymore $redis->zRem("tracking:clicks", $link); - break; } } } - $short = $redis->get("links:$link"); + $short = $redis->lRange("links:$link", 0, 0); if($short){ - echo $short; + header('location:'.$short[0]); exit(5); } } @@ -68,15 +67,11 @@ exit 13 - Shortener About redirection */ - // This has been depreciated. Still here for backwards compatibility with existing links - if(!empty($_GET['l'])){ - followLink($redis, $_GET['l']); - } - - // New way to check for valid short links, two characters shorter than the if statement above if(!empty($_GET)){ $key = key($_GET); + if($key == "l") $key = $_GET['l']; + if($key == "stats"){ header("location:http://s.lob.li"); exit(11); } if($key == "resolv"){ header("location:http://r.lob.li"); exit(12); } if($key == "about"){ header("location:http://a.lob.li"); exit(13); }