我正在尝试使用 .向我的登录/注册系统添加重新发送验证操作tampus login system
。我正在关注本教程。
问问题
817 次
1 回答
-3
好吧,我不是 php 框架的粉丝,所以我会用 MySQL 为你做这个:
if(empty($_POST["user"]) || empty($_POST["pass"])){
echo "Missing values";
} else {
//You would need the mysql connection variable named $db_conn
$db_conn = mysqli_connect("localhost","user","pass","db_name");
$user = $_POST["user"];
$pass = md5($_POST["pass"]);//MD5 encrypt;
$sql = "SELECT id FROM users WHERE username='$user' AND password='$pass'"
$query = mysqli_query($db_conn,$sql);
if(mysql_num_rows($query) > 1){
//Do the login thingys like cookies and redirects
} else {
echo "Check your credentials";
}
}
我想我不能让它更容易更好地理解
于 2013-10-04T01:55:52.133 回答