/ Published in: PHP
I thought I would share this simple username password PHP auth script. It leans on HTTP to secure a page.. not bulletproof but quick and painless.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php // input user/pass below $username = "INSERT YOUR DESIRED USERNAME HERE"; $password = "INSERT YOUR DESIRED PASSWORD HERE"; // password protect via http $_SERVER['PHP_AUTH_USER'] == $username && $_SERVER['PHP_AUTH_PW'] == $password)){ }else{ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Page Name</title> </head> <body> <!-- // html --> </body> </html> <?php } ?>
URL: http://www.thatgrafix.com