Mastrix01 Posted January 23, 2011 Share Posted January 23, 2011 Hi, I have a problem with my code probably it's authorisation mistake or something. I bought a book PHP6, MySQL, Apache Web Development and I am copying every excercise like it's in the book. If u have this book it's chapter 2, page 63. And here is the exact code from the book. It always says that the user ID or pass is incorrect. <?php session_start (); $_SESSION['username'] = $_POST['user']; $_SESSION['userpass'] = $_POST['pass']; $_SESSION['authuser'] = 1; //over uzivatelske meno a heslo if ( ($_SESSION['username'] == 'Peter') and ($_SESSION['userpas'] == '12345')) { $_SESSION['authuser'] = 1; } else { echo "Unfortunately you do not have required authorisation to enter this site!"; exit(); } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Najts oblubeny film!</title> </head> <body> <?php $oblubenyfilm = urlencode('Zivot Briana'); echo '<a href="moviesite.php?oblfilm=$oblubenyfilm\">'; echo 'Dalsie informacie o mojom oblubenom filme!'; echo '</a>' ?> </body> </html> The page is http://www.magicfoto.gigacast.net/test/login.php as you can see ID is "Peter" and pass "12345" If you know what should be wrong pls reply. PS.: I am a begginer so please be patient Thanks Link to comment https://forums.phpfreaks.com/topic/225397-user-auth-problem/ Share on other sites More sharing options...
PaulRyan Posted January 23, 2011 Share Posted January 23, 2011 Most likely the spelling error in the userpass SESSION variable... $_SESSION['userpas'] == '12345' Change it too... $_SESSION['userpass'] == '12345' Regards, PaulRyan. Link to comment https://forums.phpfreaks.com/topic/225397-user-auth-problem/#findComment-1163960 Share on other sites More sharing options...
Mastrix01 Posted January 23, 2011 Author Share Posted January 23, 2011 oh man, what a mistake anyway many thanks Link to comment https://forums.phpfreaks.com/topic/225397-user-auth-problem/#findComment-1163967 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.