Your Resolved link:
$link
",
"
Your link:
$link is not a lob.li link.
However we found that it has been shortened.
lob.li/$short
",
"
Your link:
$link is not a lob.li link and has not been shortened.
"
);
require('Include/PHP/functions.php');
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.
");
}
//$short = sanitize($_POST['link'], $seperator);
$short = $_POST['link'];
$linkage = $_POST['linkage'];
//echo $short;
if(strpos($short, "http://") === false && strpos($short, "https://") === false){
$short = "http://$short";
}
$reShort = shorten($redis, $short, $linkage, $seperator);
$reShort = explode($seperator, $reShort);
$retCode = $reShort[0];
switch($retCode){
case "0": // Successful link Shorten
$short = $reShort[1];
$title = $reShort[2];
echo "
";
break;
case "1": // Existing Short Link Found
$short = $reShort[1];
$title = $reShort[2];
echo "
";
break;
case "2": // Dead Link
$link = $reShort[1];
echo "
ERROR! - Your link:
$link didn't resolve to a website.
Please check your link and try again.
";
break;
case "3": // DB Error
$error = $reShort[1];
echo "
ERROR! - Well this is embarrassing... This never happens, but I appear to have suffered a database error.
Here's what I know: $error
";
break;
case "4": // Sanitize Failure Error
echo "
ERROR! - The sanitize function seems to have failed. This shouldn't happen, maybe
c0de forgot a semi-colon somewhere or something.
";
break;
default:
echo "Oh Noes! Something happened and I can't continue.
Please try again by using the form located at
lob.li.
";
break;
}
exit;
//foreach($messages as $message){
// echo $message;
//}
}else{ die("I can't do my job if I'm not given a link to work on...
"); }
?>