Why does $username always output an empty string using var_dump()?
ice warmer
ice warmer 2019-05-18 16:04:56
0
1
1282

<?php

if(!isset($_POST['submit'])){  

    exit('非法访问!');  

}  

$username=htmlspecialchars($_POST["username"]);

var_dump($username);

$password=MD5($_POST["password"]);

$con=mysqli_connect('localhost','root','greg1997714','ky');

if(mysqli_errno($con))

{

echo 'mysqli_error($con)';

exit;

}

$sql1="select user_name,user_password from users where user_name='$username' limit=1";

$sql2="select user_name,user_password from users where user_name='$username' and user_password='$password' limit=1";

$result = mysqli_num_rows(mysqli_query($con,$sql1));

echo $result;

if($result)

{

echo"<script>alert('用户名不正确!');history.go(-1);</script>"; 

exit;

mysqli_close($con);

}

$result = mysqli_num_rows(mysqli_query($con,$sql2));

if($result)

{

echo"<script>alert('密码有误!');history.go(-1);</script>"; 

exit;

mysqli_close($con);

}

echo"登陆成功!";


mysqli_close($con);

?>


ice warmer
ice warmer

reply all(1)
冉七

$_POST["username"] Did you get the value? If not, it means there is a problem with the post request itself

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template