diff --git a/index.php b/index.php index d74135c..ddafe1d 100644 --- a/index.php +++ b/index.php @@ -28,15 +28,14 @@ */ 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"); - } + $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;"; + if($result = $shortdb->query($sql)){ + if($row = $result->fetch_assoc()){ + $link = $row['link']; + header("location:$link"); } } }