登录页面在验证时返回BLANK页面,无论用户的凭据是否正确,我的猜测是我在解析$result->execute(array());
实例时遇到问题。
<?php
session_start();
ini_set('display_errors', 1);
error_reporting(~0);
include 'connectlgn.php';
if(empty($_POST['uName']) OR empty($_POST['uPass'])){
echo "Fill all the fields!";
}else{
$query = "SELECT * FROM dbo.wblgntst WHERE uname = :name AND upass = :pw";
$result = $conn->prepare($query);
$result->execute([':name' => $_POST['uName'], ':pw' => $_POST['uPass']]);
while ($row = $result->fetch(PDO::FETCH_ASSOC)){
if($row['uname'] === $_POST['uName'] AND $row['upass'] === $_POST['uPass']){
header("Location: list.php");
$uid = $row['uname'];
$_SESSION['userID'] = 1;
}else{
echo 'Authentication failed';
}
}
}
?>