query("SELECT ArtistID, Name FROM artists_alias WHERE Name LIKE '".db_string($NameSearch)."'"); if($DB->record_count() == 0) { if(isset($LoggedUser['SearchType']) && $LoggedUser['SearchType']) { header('Location: torrents.php?action=advanced&artistname='.urlencode($_GET['artistname'])); } else { header('Location: torrents.php?searchstr='.urlencode($_GET['artistname'])); } die(); } list($FirstID, $Name) = $DB->next_record(MYSQLI_NUM, false); if($DB->record_count() == 1 || !strcasecmp($Name,$NameSearch)) { header('Location: artist.php?id='.$FirstID); die(); } while(list($ID, $Name) = $DB->next_record(MYSQLI_NUM, false)) { if(!strcasecmp($Name,$NameSearch)) { header('Location: artist.php?id='.$ID); die(); } } header('Location: artist.php?id='.$FirstID); die(); } else { header('Location: torrents.php'); } } ?>