我正在建立一个与数据库链接的登录系统,我想在从数据库中检查数据后显示一个html文件。因此,我使用了(include方法),它向我显示了控制台中不在Web上的html文件。页。
我已经尝试使用(require方法)并将其更改为php文件,并且仍在执行相同操作。
<?php
$dbsevername = "127.0.0.1";
$dbusername = "root";
$dbpassword = "**************";
$dbname = "loginsystem";
$dbport = '3306';
$username = $_POST['username'];
$password = $_POST['password'];
$_SESSION["favcolor"] = "green";
$conn = mysqli_connect($dbsevername, $dbusername, $dbpassword,$dbname);
$sql = "SELECT * FROM passwords where username='$username' and password='$password';";
$result = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result); // = 2
if ($resultCheck > 0) {
while($row = mysqli_fetch_assoc($result)){
if ($row['username'] == $username && $row['password'] == $password) {
include("true.html");
}
}
}else {
include("false.html");
}
mysqli_close($conn);
?>
我想在检查数据时打开(true.php)或(false.php)。
慕少森
莫回无
qq_笑_17