Page is a not externally linkable
- WebmasterWorld
-- New To Web Development
---- Header Authentication


naiquevin - 3:51 am on May 29, 2009 (gmt 0)


Ok ... I am using this code for authentication

<?php

// Username and Password for authorization

$username = 'somename';
$password = 'somepassword';

if(!isset($_SERVER['PHP_AUTH_USER']) ¦¦ !isset($_SERVER['PHP_AUTH_PW']) ¦¦ ($_SERVER['PHP_AUTH_USER'] != $username) ¦¦ ($_SERVER['PHP_AUTH_PW'] != $password)) {
// The username and password are incorrect and so send the authentication headers

header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate:Basic realm ="My website"');
exit('<div align="center"><h2> My website </h2> You must enter valid username and password to access this page.');

}

?>


Thread source:: http://www.webmasterworld.com/new_web_development/3921564.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com