diff --git a/incl/lib/mainLib.php b/incl/lib/mainLib.php index e6760efdf..8a169e106 100644 --- a/incl/lib/mainLib.php +++ b/incl/lib/mainLib.php @@ -662,11 +662,11 @@ public function songReupload($url){ if (filter_var($song, FILTER_VALIDATE_URL) == TRUE && substr($song, 0, 4) == "http") { $song = str_replace(["?dl=0","?dl=1"],"",$song); $song = trim($song); - $query = $db->prepare("SELECT count(*) FROM songs WHERE download = :download"); + $query = $db->prepare("SELECT id FROM songs WHERE download = :download"); $query->execute([':download' => $song]); - $count = $query->fetchColumn(); - if($count != 0){ - return "-3"; + $id = $query->fetchColumn(); + if($id != false){ + return $id; } $name = ExploitPatch::remove(urldecode(str_replace([".mp3",".webm",".mp4",".wav"], "", basename($song)))); $author = "Reupload"; diff --git a/tools/songAdd.php b/tools/songAdd.php index a544cddf6..93f0d07d4 100644 --- a/tools/songAdd.php +++ b/tools/songAdd.php @@ -11,10 +11,8 @@ exit("Invalid captcha response"); $result = $gs->songReupload($_POST['songlink']); - if($result == "-4"){ + if($result == "-4") echo "This URL doesn't point to a valid audio file."; - }elseif($result == "-3") - echo "This song already exists in our database."; elseif($result == "-2") echo "The download link isn't a valid URL"; else