Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Why is simple PHP header authorization not working
- $username = 'test';
- $password = 'test';
- If (!isset($_SERVER['PHP_AUTH_USER'])|| !isset($_SERVER ['PHP_AUTH_PW'])||
- ($_SERVER['PHP_AUTH_USER'] != $username) || ($_SERVER['PHP_AUTH_PW'] != $password)){
- //send this if the user and pass arent correct
- header('HTTP/1.1 401 Unauthorized');
- header('WWW-Authenticate: Basic Realm= "mysite"');
- exit('<h2> Go away Creep!!</h2> you need a username and password to enter this kingdom!!');
- }
Add Comment
Please, Sign In to add comment