From f5f143d2e61d41f43bae3761bab1dcc29f38edd8 Mon Sep 17 00:00:00 2001 From: alopexc0de Date: Fri, 15 Aug 2014 18:34:46 -0400 Subject: [PATCH] Attempt begin resolving links and testing code. This is still incomplete, but should be finished soon --- Website/process.php | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/Website/process.php b/Website/process.php index 6bd689d..b064ee0 100644 --- a/Website/process.php +++ b/Website/process.php @@ -45,17 +45,37 @@ - ", - " -
- Your link: - $link is not a lob.li link and has not been shortened. -
" ); require('Include/PHP/functions.php'); + if(isset($_GET['resolve']) && !empty($_POST['link'])){ + if(empty($_GET['token']) || $_GET['token'] != $_SESSION['token'] || empty($_POST[$catchid]) || $_POST[$catchid] != $catchVal){ + die("
Oh Noes! Something happened and I can't continue.
Please try again by using the form located at lob.li.
"); + } + + $link = $_POST['link']; + $trTtl = $redis->ttl("links:$link"); + if($trTtl == -2){ // Didn't find links:linkid, checking if long link + $trTtl = $redis->ttl("llinks:$link"); + if($trTtl == -2){ // Didn't find that either, give error + echo " +
+ Your link: + $link is not a lob.li link and has not been shortened. +
+ "; + exit; + } + } + + $short = $redis->lRange("links:$link", 0, 1); + print_r($short); exit; + + + } + if(!empty($_POST['link']) || !empty($_POST['linkage'])){ if(empty($_GET['token']) || $_GET['token'] != $_SESSION['token'] || empty($_POST[$catchid]) || $_POST[$catchid] != $catchVal){ die("
Oh Noes! Something happened and I can't continue.
Please try again by using the form located at lob.li.
");