gpt4 book ai didi

php - Bootstrap 和 PHP 登录表单在提交时显示空白屏幕

转载 作者:行者123 更新时间:2023-11-29 16:36:09 24 4
gpt4 key购买 nike

我为我的项目网站创建了一个登录页面。我在使用 PHP 方面是全新的,所以我看了一些关于如何创建登录文件的示例,但到目前为止我尝试过的所有示例都只导致我看到一个空白的屏幕,没有错误,也没有页面源中的内容。

如有任何帮助,我们将不胜感激。

这是我的login.php 文件 -

   <?php
ini_set('display_errors','1');

include "connect.php"

if(isset($_POST['submit'])){
$Uname = filter_input(INPUT_POST, 'Uname', FILTER_SANITIZE_STRING);
$password = filter_input(INPUT_POST, 'Pword', FILTER_SANITIZE_STRING);
$hashedpassword = password_hash($password, PASSWORD_DEFAULT);
$check = mysqli_prepare($conn, "SELECT * FROM Userdatabase WHERE Username = ? AND Password = ?");
mysqli_stmt_bind_param($check, "ss", $Uname, $hashedpassword);
mysqli_stmt_bind_result($check, $result);
if ($Uname == "NTLADMIN" AND password_verify($password, $hashedpassword))
{
header("Location: admin.html");
}
if (mysqli_num_rows($result) == 1)
{
$_SESSION['Username'] = $Uname;
$nameget = mysqli_prepare($conn, "SELECT name FROM userdatabase WHERE Username = ? AND Password = ?");
mysqli_stmt_bind_param($nameget, "ss", $Uname, $password);
mysqli_stmt_bind_result($name);
setcookie("user", $name);
header("Location: index.html");
}
mysqli_stmt_close($inputs);
mysqli_close();
}
?>

<!DOCTYPE html>
<html>
<head>
<title> Login </title>
<meta charset = "UTF-8">
<meta name="viewport" content="width=device-width, initial_scale=1.0">
<link rel = "stylesheet" href = "css/bootstrap.css">
<link rel = "stylesheet" href = "css/style.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
</head>
<body>
</br>
</br>
<div class="container" style = "background-color: rgba(170, 170, 170, 0.88);">
<form class="form-signin" action = "login.php" method="post">
<h1 class="form-signin-heading">LOGIN</h1>
</br>
<label for="Uname" class="sr-only">Username</label>
<input name="Uname" type="text" id="Uname" class="form-control" placeholder="Username" required autofocus>
<label for="Pword" class="sr-only">Password</label>
<input name ="Pword" type="password" id="Pword" class="form-control" placeholder="Password" required>
<button class="btn btn-lg btn-primary btn-block" for="submit" type= "submit">Submit</button>
</form>
</br>
</div>

</body>
</html>

最佳答案

向您的按钮添加NAME

<button class="btn btn-lg btn-primary btn-block" for="submit" type= "submit" name="submit">Submit</button>

关于php - Bootstrap 和 PHP 登录表单在提交时显示空白屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53604342/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com