Posted 30 December 2011 - 12:14 PM
If anyone could help, I'd appreciate it.
Posted 30 December 2011 - 1:54 PM
Posted 30 December 2011 - 4:05 PM
Somehow, I knew this would be an easy fix. Logged in and it works fine. I've tried to work with some other books but didn't get much out of them. This book is great! I've recommended it to my class and will continue working through the entire series. Thanks for the book(s) and the website. They have both been really helpful.
Posted 30 December 2011 - 4:53 PM
Posted 1 January 2012 - 1:53 PM
Posted 2 January 2012 - 11:41 AM
Posted 10 June 2014 - 2:50 PM
Ok, I can not log in on my own site? I have access premitted for user (myself) on go daddy data base? I can sign in under email@example.com password testpass. Here's my code:
Posted 11 June 2014 - 9:49 AM
I need help, please. My database and tables and created. I can not login as administrator and I can't figure out how to. I can't view add or edit a quote because I am not the administrator. I have tried everything I know. I am showing that my cookies are created.
Posted 11 June 2014 - 10:09 PM
That exact code only allows firstname.lastname@example.org/testpass to login. It doesn't use a database. It doesn't have administrators.
Posted 12 June 2014 - 8:20 AM
So, if I change that code to my email and password I would still only be able to log in as a user and not as an admin. How do I log in as an admin, Lar? I've gone over everything a million times but can't figure it out.
Posted 12 June 2014 - 8:03 PM
You see this line:
if ( (strtolower($_POST['email']) == 'email@example.com') && ($_POST['password'] == 'testpass') )
It says :
If the input field named "email" contains firstname.lastname@example.org AND the input field named "password" contains "testpass", create cookie and set the variable $testpass = true
The $_POST['email'] array will be set to whatever field named "email" is posted from the form. Same thing with the $_POST['password']. so if you have an input field like this: <input type="text" name="email">, well the $_POST['email'] will contains the value entered in that field.
Now, there's nothing accessing a database in the code you posted, so changing anything in any database won't have any effect on how the code you pasted here works.
But, if you change the line with the hardcoded email and password to whatever you want, yes, it'll work.