mirror of
https://github.com/gamaio/UnPS-Short.git
synced 2024-11-14 04:57:25 +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:
parent
2749abd20d
commit
b62f922cb1
16
index.php
16
index.php
@ -13,6 +13,7 @@
|
|||||||
$catchVal = base_convert($catchVal.$catchid, 10, 36);
|
$catchVal = base_convert($catchVal.$catchid, 10, 36);
|
||||||
$_SESSION['catch'] = $catchid.":".$catchVal;
|
$_SESSION['catch'] = $catchid.":".$catchVal;
|
||||||
|
|
||||||
|
/* -- Hopefully depreciated, testing /?id
|
||||||
if(!empty($_GET['l'])){
|
if(!empty($_GET['l'])){
|
||||||
include('api/dbsettings.php');
|
include('api/dbsettings.php');
|
||||||
$link = $shortdb->real_escape_string(strtolower(stripslashes(strip_tags($_GET['l']))));
|
$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'])){
|
if(isset($_GET['newbg'])){
|
||||||
echo "<style>body{background-image: url('assets/images/newbody.jpg') !important;}</style>";
|
echo "<style>body{background-image: url('assets/images/newbody.jpg') !important;}</style>";
|
||||||
|
Loading…
Reference in New Issue
Block a user