mirror of
https://github.com/gamaio/unps.us-Shortener.git
synced 2024-12-22 02:02:40 +00:00
Remove foreach loop and fix multiple id vulnerability
I found that right after committing the last commit, the last id entered would be the one finally redirected to. This also slowed page load time. By grabbing only the very first key of $_GET and throwing away the rest, the script will only look at the first string after the '?' Need to change links to reflect these changes (or it will try to redirect to 'l' everytime instead of the id)
This commit is contained in:
parent
b62f922cb1
commit
63a2724f86
@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
if(!empty($_GET)){
|
||||
foreach($_GET as $key=>$value){
|
||||
$key = key($_GET);
|
||||
include('api/dbsettings.php');
|
||||
$link = $shortdb->real_escape_string(strtolower(stripslashes(strip_tags($key))));
|
||||
$sql = "SELECT * FROM `links` WHERE `shortlink` = '$link' LIMIT 1;";
|
||||
@ -39,7 +39,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_GET['newbg'])){
|
||||
echo "<style>body{background-image: url('assets/images/newbody.jpg') !important;}</style>";
|
||||
|
Loading…
Reference in New Issue
Block a user