Maybe a little stupid question, but still could not help asking ..

In MySQL, I set the password 123ijdb - hash 727eee025601b4279260d8aa0a7aa0cc

I check:

<?php $pass = '123'; $password = md5(pass . 'ijdb'); //123ijdb echo $password; ?> 

At the output we have all the same hash 727eee025601b4279260d8aa0a7aa0cc

And now pass the data from the text box of the form:

 $password = md5($pass . 'ijdb'); 

I enter 123, and the other hash is ac477232f1188855df4214b94cafab2b

And if you do this:

 $pass = $_POST['password']; $password = md5($pass . 'ijdb'); 

The output is the "correct" hash 727eee025601b4279260d8aa0a7aa0cc

Actually, I wonder why this is so if you save the hash to a variable, then everything works, and if not, it does not work, but the password does not change.

  • In md5 (pass. 'Ijdb'); - pass is not variable. Change to $ pass - zhenyab
  • That is, php itself should guess that you want to have some data in $ pass? - ReinRaus

1 answer 1

Where does the data in the $ pass variable come from?

 $password = md5($pass . 'ijdb'); 

Here is the correct assignment, read about $ _POST / $ _ GET variables.

 $pass = $_POST['password']; $password = md5($pass . 'ijdb');