我在解决这个问题时遇到了很大的问题,我对php不是很熟悉。我没有看到代码中遗漏任何问题。我已经搜索过了很长一段时间。但是,它只是不断地从一个问题转变为另一个问题。出现的错误看起来像这样,
未定义变量:第19行/home2/abdi/public_html/phpinfo.php/login files / login.php中的密码
这是实际代码
<?php error_reporting(E_ALL); ini_set('display_errors', 1); session_start(); //connect to database $db=mysqli_connect("localhost","abdi_yae","abdi_yae123","abdi_ya"); if(isset($_POST['login_btn'])) { addslashes(trim($_POST['username'])); addslashes(trim($_POST['password'])); //$username=mysqli_real_escape_string($_POST['username']); // $password=mysqli_real_escape_string($_POST['password']); $password=md5($password); //Remember we hashed password before storing last time $sql="SELECT * FROM users WHERE username='$username' AND password='$password'"; $result=mysqli_query($db,$sql); if(mysqli_num_rows($result)==1) { $_SESSION['message']="You are now Logged In"; $_SESSION['username']= $username; header("location:home.php"); } else { $_SESSION['message']="Username and Password combiation incorrect"; } } ?>
答案 0 :(得分:0)
您需要为此设置密码变量。
var inc = {$inc: {}};
inc.$inc['inventory.'+itemName+"."+statName] = 1; // itemName and statName are variables created by user
userDoc.update({"userId": userId}, inc);
答案 1 :(得分:0)
<?php error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start(); //connect to database
$db=mysqli_connect("localhost","abdi_yae","abdi_yae123","abdi_ya");
if(isset($_POST['login_btn'])) {
$username = addslashes(trim($_POST['username']));
//addslashes(trim($_POST['password']));
//$username=mysqli_real_escape_string($_POST['username']);
// $password=mysqli_real_escape_string($_POST['password']);
$password=md5($_POST['password']); //Remember we hashed password before storing last time
$sql="SELECT * FROM users WHERE username='$username' AND password='$password'";
$result=mysqli_query($db,$sql);
if(mysqli_num_rows($result)==1)
{
$_SESSION['message']="You are now Logged In";
$_SESSION['username']= $username;
header("location:home.php");
}
else
{
$_SESSION['message']="Username and Password combiation incorrect";
}
}
?>
立即检查好友。它完成了