Im tying to use the authentication code for the admin side to my site but i either im not writing the code correctly or i don't understand. probably both but wondered if you could help
The authentication window is coming up fine but
i basically don't know what username and password into the box. i thick its what is hardcoded in the code but it doesn't work - can you explain this to me am i doing something wrong. if i am how do i set the username and password so that it does work please. PHP:
<?php # authentication.php
//This page handles the authentication for the admin pages
$authorized = FALSE; // Initialise a variable
//Check for authentication submission.
if ( ( isset($_SERVER['PHP_AUTH_USER']) AND isset($_SERVER['PHP_AUTH_PW'])) ) {
if ( ($_SERVER['PHP_AUTH_USER'] == 'CC006200') AND ($_SERVER['PHP_AUTH_PW'] == 'arsenal') ) { // if the correct values were entered ...
$authorized = TRUE;
}
}
//If they haven't been authorised, create the pop-up window.
if (!$authorized) {
header('WWW-Authenticate: Basic realm="Administration"');
header('HTTP/1.0 401 Unauthorized');
// For cancellations
}
?>
If this is not a good way to set up an admin side, is there a better way because all i have at the moment is access for normal registered users through a mysql database, can someone explain how to set up an admin side with a different homepage please.