http://www.giorgiotave.it/forum/php-mysql/16163-controllo-utente-esiste-gia.html

guarda qui!