且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何验证在PHP / MySQL的用户?

更新时间:2023-02-15 15:53:33

这是不是直接回答这个问题,但一个良好的增值服务。
您应该使用MYSQL SHA1功能存储到数据库之前加密密码。

This is not a direct answer to this question but a GOOD value-add. You should use MYSQL SHA1 function to encrypt the password before storing into the database.

$user = $_POST['userid'];
$pwd = $_POST['password'];
$insert_sql = "INSERT into USER(userid, password) VALUES($user, SHA1($pwd))";

$select_sql = "SELECT * FROM USER WHERE userid=$user AND password=SHA1($pwd))";