mirror of
https://github.com/gamaio/unps.us-Shortener.git
synced 2025-07-30 13:50:17 +00:00
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:
16
index.php
16
index.php
@@ -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>";
|
||||
|
Reference in New Issue
Block a user