security - php secure login -
What do you think about this login process? Is it very safe?
When they log in, I first know that username is present, if I catch the salt (the unique salt of every user) from the user, then I have a hash with the posted password again.
$ pass = hash ('sha256', $ salt. $ Post_password);
And then I just compare with
$ check = mysql_query ("Choose where user name is from user" = ". $ Username." 'And password =' ". $. Pass" "") or die ("MySQL error:". Mysql_error ());
I do not think it is a good idea to post mysql error if it fails.
or die (" MySQL error: ". Mysql_error ( ));
When it comes to doing this, I'll say less information you returned better The user who is trying to log in, whether the username or password that has failed, is not good, it tells you what type of database the user is using, how it asks, Etc.
Further and realize that the most frequent protection in these situations is being removed, through social engineering, and in that case, it does not matter How did you hash data, etc. (Not that you do not want) just to say that security is very high, and it itself how does limit the data to store and retrieve. For example, what is entered through the encrypted line? Does anyone have the power of the user's password? What happens after the user logs in, how do you track only log users, who are just going to the site? How can you stop session acquisitions, etc. I'm not an expert on this topic, but this is a widespread subject. Maybe you wanted to comment on the code you just posted, in this case you should have read the top paragraphs;; With the answer of the robot :)
Comments
Post a Comment