shouldn't
userid <> $userid be replaced by:
userid='$userid'?
try this code instead then:
PHP Code:
if ($exists=$DB_site->query_first("SELECT userid FROM user WHERE username='".addslashes(htmlspecialchars($ausername))."' AND userid='$userid'")) {
echo "There is already an ".makelinkcode('user',"user.php?do=edit&userid=$exists[userid]",1)." named <b>".htmlspecialchars($ausername)."</b>";
exit;
}