query("SELECT AliasID, ArtistID FROM artists_alias WHERE Name='".$AliasName."'"); list($CloneAliasID, $CloneArtistID) = $DB->next_record(); if($CloneAliasID) { if($Redirect == 0) { $DB->query("UPDATE artists_alias SET ArtistID='".$ArtistID."', Redirect=0 WHERE AliasID='".$CloneAliasID."'"); } else { error('An alias by that name already exists here. You can try renaming that artist to this one.'); } } $DB->query("INSERT INTO artists_alias(ArtistID, Name, Redirect, UserID) VALUES (".$ArtistID.", '".$AliasName."', ".$Redirect.", ".$LoggedUser['ID'].")"); $AliasID = $DB->inserted_id(); $DB->query("SELECT Name FROM artists_group WHERE ArtistID=".$ArtistID); list($ArtistName) = $DB->next_record(); write_log("The alias ".$AliasID." (".$AliasName.") was added to the artist ".$ArtistID." (".$ArtistName.") by user ".$LoggedUser['ID']." (".$LoggedUser['Username'].")"); header('Location: '.$_SERVER['HTTP_REFERER']); ?>