我使用用户名作为弹簧安全的盐但是当我尝试在php中执行类似的情况时,它会生成一个不同的哈希密码。以下是我的PHP代码:
<?php
$un=$_POST['username'];
$pw=$_POST['password'];
$salt ='weiren';
$passw='enjoyit';
$pass=md5($passw.md5($salt));
mysql_connect("localhost","root","");
mysql_select_db("dbname");
$sql=mysql_query("select * from people where username = '$un' and password = '$pw'");
if(mysql_num_rows($sql) > 0)
// ( $un == “ajay” && $pw == “ajay”)
echo 1; // for correct login response
else
echo $pass;
// for incorrect login response
?>