首页 >社区问答列表 >为什么$username用var_dump()输出的一直是空字符串

为什么$username用var_dump()输出的一直是空字符串

<?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);

?>