Broke the shortener

I broke everything.
This commit is contained in:
Arctic Code
2014-04-13 19:50:36 -05:00
parent c1c557ed07
commit 25ab98ae1c
4 changed files with 48 additions and 29 deletions

View File

@@ -5,10 +5,6 @@
$catchid = $catches[0];
$catchVal = $catches[1];
if(empty($_GET['token']) || $_GET['token'] != $_SESSION['token'] || empty($_POST[$catchid]) || $_POST[$catchid] != $catchVal){
die("<div id=\"error\">Oh Noes! Something happened and I can't continue.<br />Please try again by using the form located at <a href=\"http://unps.us\">http://unps.us</a>.</div>");
}
require('api/api.backend.php');
require('api/dbsettings.php');
@@ -24,13 +20,16 @@
$unpsAPI = new api();
if(!empty($_POST['link']) && !empty($_POST['linkmod'])){
if(empty($_GET['token']) || $_GET['token'] != $_SESSION['token'] || empty($_POST[$catchid]) || $_POST[$catchid] != $catchVal){
die("<div id=\"error\">Oh Noes! Something happened and I can't continue.<br />Please try again by using the form located at <a href=\"http://unps.us\">http://unps.us</a>.</div>");
}
switch ($_POST['linkmod']){
case "shorten":
$short = sanitize($_POST['link']);
if(strpos($short, "http://") === false && strpos($short, "https://") === false){
$short = "http://$short";
}
echo $unpsAPI->shorten($apidb, $key, $shortdb, $short);
echo $unpsAPI->shorten($short);
break;
default:
die("<div id=\"error\">I don't know what you want to do... [-Check linkmod-]</div>");