Enforcing Basic authentication
<?php header('WWW-Authenticate: Basic realm="My Website"'); header('HTTP/1.0 401 Unauthorized'); echo "You need to enter a valid username and password."; exit(); ?>