Do you know you can implement http authentication using php code? HTTP authentications are those you see when you open control panel or administrative backend website, prompting for username and password in html authentication prompt.


This can be done in php using following code:

if (!isset($_SERVER[‘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’; exit; } else { echo


; echo

You entered {$_SERVER[‘PHP_AUTH_PW’]} as your password.

; } ?>