ma con htaccess non dovrebbe uscire una finestrella che ti chiede di inserire utente e passw?che ti serve uno script in php?

edito:
http://wiki.porteapertesulweb.it/spa...ss+e+.htpasswd

configura il tuo htaccess leggendo questa guida
ciao