Mega Code Archive

 
Categories / Php / HTML
 

HTTP Authentication example

<?php if(!isset($PHP_AUTH_USER)) {     Header("WWW-Authenticate: Basic realm=\"My Realm\"");     Header("HTTP/1.0 401 Unauthorized");     echo "Text to send if user hits Cancel button\n";     exit; } else {     echo "Hello $PHP_AUTH_USER.<P>";     echo "You entered $PHP_AUTH_PW as your password.<P>"; } ?>