我有一个使用电子邮件和密码设置的数据库,我正在尝试使用下面的代码检查用户名(电子邮件)和密码,以确保它们正确,如果它们不正确则将它们发送到 /cms匹配,弹出框出现。我只是开始工作。你能看到任何会导致这种情况的问题吗?
session_start();
require_once("../mydbpassword.php");
if($_POST['username']) {
$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM agents WHERE email = '$username' AND pword = '$password'";
$result = mysqli_query($mysqli,$sql);
$email = $row['email'];
$pword = $row['pword'];
if(($username != $email) || ($password != $pword)) {
echo'<script type="text/javascript">
window.alert("Your login information is wrong, try again!");
window.location="/cms/login"
</script>';
}
else {
$row = mysqli_fetch_assoc($result);
$_SESSION['admin'] = $row['$email'];
header("Location: /cmsS");
exit();
}
}