Make short links two characters shorter

By breaking up the $_GET array and grabbing the key (what used to be l),
ignoring the value, we can shorten links by two more characters.
This is kinda hacky since it does this for multiple get values
-- Still need to test to see what happens with multiple link ids.
I assume it will just go with the first id given
This commit is contained in:
Arctic Code 2014-01-29 01:31:27 -06:00
parent 2749abd20d
commit b62f922cb1
1 changed files with 16 additions and 0 deletions

View File

@ -13,6 +13,7 @@
$catchVal = base_convert($catchVal.$catchid, 10, 36);
$_SESSION['catch'] = $catchid.":".$catchVal;
/* -- Hopefully depreciated, testing /?id
if(!empty($_GET['l'])){
include('api/dbsettings.php');
$link = $shortdb->real_escape_string(strtolower(stripslashes(strip_tags($_GET['l']))));
@ -24,6 +25,21 @@
}
}
}
*/
if(!empty($_GET)){
foreach($_GET as $key=>$value){
include('api/dbsettings.php');
$link = $shortdb->real_escape_string(strtolower(stripslashes(strip_tags($key))));
$sql = "SELECT * FROM `links` WHERE `shortlink` = '$link' LIMIT 1;";
if($result = $shortdb->query($sql)){
if($row = $result->fetch_assoc()){
$link = $row['link'];
header("location:$link");
}
}
}
}
if(isset($_GET['newbg'])){
echo "<style>body{background-image: url('assets/images/newbody.jpg') !important;}</style>";