|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
http authentication not working?
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 window with the authentication box comes 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: -------------------------------------------------------------------------------- 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 for making an admin side to the site. Could someone explain to me how to make a good one, because all i have at the moment is access for normal users to register but would like some sort of admin side. - cheers |
|
#2
|
||||
|
||||
|
Works when I run it on my system. Maybe it's an apache setting gone wrong?
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Advanced Web Development > http authentication not working? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|