php login page

Hey guys, sorry to bump an old thread, but I am having difficulties applying the script that kwquin laid out to my existing pages. Just to be clear, I want to password protect a page called allonesearch.php and accountsearch.php. Is there a way to do this with the code in this thread?

SaintAnthony

you can use php auth

http://php.net/manual/en/features.http-auth.php

but that wont let any people see that file but you or who has the password and username

[php]$login = ‘test_login’;
$pass = ‘test_pass’;

if(($_SERVER[‘PHP_AUTH_PW’]!= $pass || $_SERVER[‘PHP_AUTH_USER’] != $login)|| !$_SERVER[‘PHP_AUTH_USER’])
{
header(‘WWW-Authenticate: Basic realm=“Test auth”’);
header(‘HTTP/1.0 401 Unauthorized’);
echo ‘Auth failed’;
exit;
}[/php]

basic password the file

Sponsor our Newsletter | Privacy Policy | Terms of Service