lRange("tracking:ip:$link", 0, -1); if(!in_array($_SERVER['REMOTE_ADDR'], $ipTrack)){ // Check to see if visiter hit this link before (This would make it a lot easier to skew statistics if anyone would register multiples times) $redis->rPush("tracking:ip:$link", $_SERVER['REMOTE_ADDR']); // Tracking code $tracking = $redis->get("tracking:clicks:$link"); $trTtl = $redis->ttl("links:id:$link"); if(!$tracking || $trTtl != -2){ $tracking = $redis->set("tracking:clicks:$link", 1); }else{ if($trTtl == -2){ // The link has been deleted, no need to track it anymore break; } $tracking = $redis->incr("tracking:clicks:$link"); } } $short = $redis->get("links:id:$link"); if($short){ echo $short; exit(5); } } // exit codes: /* exit 0 - Good script exit 5 - Link redirection 10x exit codes exit 11 - Shortener Stats redirection exit 12 - Shortener Resolver redirection 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 == "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); } followLink($redis, $key); } ?> lob.li - Objective Links
How long should I keep your link?

Please give me a link to shorten...

loading.... Please Wait