moldboy 0 Report post Posted January 15, 2006 I have a book called PHP and MySQL for dynamic web sites by Larry Ullman, and it's a very good book which I would recomend to anyone wanting to learn, but I followed a project in this book, not letter by letter, and it won' work.I wrote this code to create an authentication script that will only work with one user but allow the credientals to be passed from one page to another. So here's the code <?PHP$aut = FALSE; //Check for user variablesif ( (isset($_server['PHP_AUTH_USER']) AND isset($_server['PHP_AUTH_PW'])) ) { //Check for correct user and password $user = $_server['PHP_AUTH_USER']; $pw = $_server['PHP_AUTH_PW']; if ($user == "user" AND $pw == "password"){ $aut = TRUE; }}//IF not authorized ask for authenticationif ($aut == FALSE){ header('WWW-Authenticate: Basic realm="d-gression HTML editor"'); header('HTTP/1.0 401 Unauthorized'); //If cancel is pressed}?> and the actual page the require points to the above code<?PHPrequire('./auth.inc');if ($aut == FALSE){ echo "please <a href=\"index.php\">try again.</a>";} else { echo "you're in!!!";}?> Share this post Link to post Share on other sites
moldboy 0 Report post Posted January 15, 2006 Well after a nights sleep I figured it out, the part where it says $_server should be $_SERVER Share this post Link to post Share on other sites
BuffaloHelp 24 Report post Posted January 15, 2006 Topic closed as reported. Share this post Link to post Share on other sites