PHP阻止在网站上显示任何内容
早上好, 我正在尝试为我的网站创建一个登录页面,但每当我将我的php脚本添加到该页面时,当我访问该网站时,什么都不会显示。当我删除php时,我可以在访问页面时看到表单 代码如下: 任何帮助都将不胜感激PHP阻止在网站上显示任何内容,php,Php,早上好, 我正在尝试为我的网站创建一个登录页面,但每当我将我的php脚本添加到该页面时,当我访问该网站时,什么都不会显示。当我删除php时,我可以在访问页面时看到表单 代码如下: 任何帮助都将不胜感激 <!doctype html> <html> <head> <title>Login Page</title> </head> <body> <form method="post" action="">
<!doctype html>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<form method="post" action="">
Email<br><input type="email" name="email"><br>
Password<br><input type="password" name="pass"><br>
<input type="submit" value="login" name="login" />
</form>
<?php
$con= mysqli_connect("localhost", "user", "passwordexample" "exampledatabase");
if(isset($_POST['login'])){
$email= mysqli_real_escape_string($con, $_POST['email']);
$password= mysqli_real_escape_string($con, $_POST['pass']);
$select_user="SELECT * FROM users WHERE Email='$email' AND Passwords='$password'";
$run_user=mysqli_query($con, $select_user);
$check_user= mysqli_num_rows($run_user);
if($check_user > 0){
header('location:form.php');
} else{
echo "wrong username or password";
}
}
?>
登录页面
电子邮件
密码
表示了解的语句。即使是这样也不安全!永远不要存储纯文本密码!请使用PHP来处理密码安全性。如果您使用的PHP版本低于5.5,则可以使用密码\u hash()
。在散列之前,请确保对它们进行了清理或使用了任何其他清理机制。这样做会更改密码并导致不必要的额外编码。是否检查了错误日志?您假设查询正在运行。在打开后立即将错误报告添加到文件顶部