Page 1 of 1

"Login" control error page

Posted: Fri Aug 03, 2018 10:58 pm
by semua
Hello, I added a "Login" control and entered the MySQL table data. I registered a user in the database and everything ok, however when I log in the page is always redirected to "Error Page". I have already tried to change the "usarname" and "password" in the database but not later. What could be happening?

Re: "Login" control error page

Posted: Sat Aug 04, 2018 6:32 am
by Pablo
Usually this behavior is related to problems with PHP sessions on the server side.

Are you sure the user is in the database?
Are there any error in the server PHP log?

Re: "Login" control error page

Posted: Mon Aug 06, 2018 12:22 pm
by semua
Hello
I can not find any mistakes. And the password is correct. Follow the link https://bit.ly/2OOwOeb. Test Login: 1, Test Password: 1. Please try.

Image

Re: "Login" control error page

Posted: Mon Aug 06, 2018 12:54 pm
by Pablo
Did you try with a normal username like user1, password1?

Usually this behavior is related to problems with PHP sessions on the server side.
Are there any errors in the server PHP log?

Re: "Login" control error page

Posted: Mon Aug 06, 2018 1:45 pm
by semua
I have tried to change the user and the password, I have tried to delete and add new users and it does not work, it always returns the same problem. And where can I see the server log (use HostGator)?

Re: "Login" control error page

Posted: Mon Aug 06, 2018 2:08 pm
by Pablo
And where can I see the server log (use HostGator)?
You will need to ask your webhost about this.

Re: "Login" control error page

Posted: Fri Aug 24, 2018 4:39 pm
by semua
I figured out what the problem is. Php uses md5 to load the password:

Code: Select all

$crypt_pass = md5($_POST['password']);
only that my password in the database is not encrypted, then the database password is compared with the password of the textbox, but as one is encrypted and another does not result in false.

I removed the md5 and it works perfectly:

Code: Select all

$crypt_pass = $_POST['password'];
But the question now is: is it safe to leave without the md5? And if it is not, how do I create a password using md5 to save to the database?

Re: "Login" control error page

Posted: Fri Aug 24, 2018 6:51 pm
by Pablo
It is safer to use md5.

This may be useful:
https://passwordsgenerator.net/md5-hash-generator/