常量仅包含数据库连接详细信息
require_once 'includes/constants.php';
class mysql{
private $conn;
function __construct(){
$this->conn = $conn = new MySQLi(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME)
or die ('There was an error in the connection');
}
function verify ($un, $pwd){
$query = "SELECT * FROM User WHERE username = ? AND pass = ? LIMIT 1";
if ($stmt = $this->conn->prepare($query))
{
$stmt->bind_param('ss', $un, $pwd);
$stmt->execute();
if ($stmt->fetch());{
$stmt->close();
return true;
}
}
}
}
?>
un 和 pwd 已从登录页面传递,它们是从用户输入中提取的,我遇到的问题是用户始终登录,无论他们输入什么,它似乎都没有针对数据库正确验证