I have Some Passwords which contain some special and methimatical chracters like this password “HHE1134ƒ” if i want to generate password with php md5() then this not give me correct hashes like this “679b6dc6122a9c83ed31476ee82af36e”.
So i have Java Script which can generate correct hash for my passwords
But how can i store this value to mysql
my code is given below please Help Me.
$result = mysql_query("SELECT * FROM `table`") or die(mysql_error());
while ($row = mysql_fetch_assoc($result))
{
$user_id = $row['user_id'];
$firstname = $row['firstname'];
$lastname = $row['lastname'];
$spno = $row['spno'];
$password = $row['password'];
$tmp = "<script type='text/javascript'> document.write(MD5('".$password."'));</script>";
$query1="UPDATE `wp_110504users` SET `user_pass` = '$tmp' WHERE `user_login` = '$user_id'";
mysql_query($query1) or die(mysql_error());
}
this will give me error like
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'text/javascript'> document.write(MD5('HW72'));' WHERE `user_login` = '0' at line 1
?>
Some one tell me use Ajax, Please tell me how can i use Ajax for this code can you give me an example …..
The premise of your question is fundamentally flawed.
I find it very hard to believe that PHP’s md5 function is not generating md5 hashes.
You’re also very confused about what runs on the browser and what runs on the client.
So you have a javascript function which produces some output which you consider valid. The corresponding PHP function does not produce output you consider valid. I presume that means you have some reference implementation which produces the same results as the Javascript – but you’ve provided no details of what this is.
Or do you mean that your Javascript function is your reference implementation – if so, please bang your head on the desk a few times, then go get a copy of a javascript implementation of md5 which works properly
Once you’ve done that, spend some time thinking about why, regardless of whether the hash function generates the expected output, generating a hash of a password (rather than a salted hash of a salted hash) on the client is a complete waste of time.