登录失败后的会话,并在login.php中检查它,而不是将其重定向到主页(index.php)
登录后会话失败,并且在登录失败后的会话,并在login.php中检查它,而不是将其重定向到主页(index.php),php,Php,登录后会话失败,并且在login.php中未将其重定向到主页(index.php)。 示例链接() 请帮帮我 username : tepbopea password : 8886188 代码Login.php: <?php session_start(); require 'dbconfig/db.php'; $a='Username'; $b='password'; if(isset($_POST['btnsend'])){ $
login.php
中未将其重定向到主页(index.php
)。
示例链接()
请帮帮我
username : tepbopea
password : 8886188
代码Login.php:
<?php
session_start();
require 'dbconfig/db.php';
$a='Username';
$b='password';
if(isset($_POST['btnsend'])){
$name=$_POST['txtusername'];
$pwd= $_POST['txtpwd'];
if(trim($name)==''){
$a="Name required";
}elseif(trim($pwd)==''){
$b="Password required";
}else{
$sql="select * from tbluser where username='$name' and password='$pwd'";
$query=mysqli_query($con,$sql);
$num= mysqli_num_rows($query);
if($num>0){
$_SESSION['userlogin']=$name;
header('location:index.php');
}else{
echo"<span style='color:red;margin-left:40%;margin-top:20px;font-family:Segoe,sans-serif;'>
Wrong Username or Password</span>";
}
}
}
尝试-
"<script>
window.location = "index.php";
</script>"
请分享你的代码…你已经尝试了这么多,我们将不知道如何以及为什么它不工作,如果你不给我们看你的代码。我们并不是所有的黑客都能入侵你的服务器并获取代码。你的登录脚本完全没有用处,因为它不能满足这个目的,很容易受到sql注入的攻击,只需在表单的“用户名和密码删除”属性中输入”或“1”='1
。希望这只是一个简单的示例,因为我希望您没有存储明文密码。。。?
header('location:index.php');