Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如果我使用用户登录,它将使用任何密码登录_Php_Html_Mysql_Sql - Fatal编程技术网

Php 如果我使用用户登录,它将使用任何密码登录

Php 如果我使用用户登录,它将使用任何密码登录,php,html,mysql,sql,Php,Html,Mysql,Sql,您的错误不在查询中。这取决于你的情况 if(mysqli_num_rows($select_user_result) == 0){ echo 'No User found'; }else{ echo 'oK'; } 你可以这样试试。我认为您的错误是您在mysqli_num_行中插入了==0,它必须在外部。您的错误不在查询中。这取决于你的情况 if(mysqli_num_rows($select_user_result) == 0){ echo 'No User found


您的错误不在查询中。这取决于你的情况

if(mysqli_num_rows($select_user_result) == 0){
    echo 'No User found';
}else{
   echo 'oK';
}

你可以这样试试。我认为您的错误是您在mysqli_num_行中插入了==0,它必须在外部。

您的错误不在查询中。这取决于你的情况

if(mysqli_num_rows($select_user_result) == 0){
    echo 'No User found';
}else{
   echo 'oK';
}

你可以这样试试。我认为您的错误是您在mysqli_num_行中插入了==0,它必须在外部。

我假设密码是字符串

$select_user_query=选择id,电子邮件地址为“$email”,密码为$password; 是你写的,


您可能忘了在$password附近加上单引号

我假设密码是一个字符串

$select_user_query=选择id,电子邮件地址为“$email”,密码为$password; 是你写的,

您可能忘了在$password附近加上单引号

请验证此代码:

我使用此代码登录:

如果用户提供了正确的凭据-如果部件正常工作, 如果没有,那么其他部分将是工作

<?php
 // Grab User submitted information
$user = $_POST["username"];
$pass = $_POST["password"];

//$uc_id=$_GET["user_check_id"];


// Connect to the database
$con = mysqli_connect("localhost","root","pass123");
// Make sure we connected successfully
if(! $con)
{
    die('Connection Failed'.mysql_error());
}
// Select the database to use
mysqli_select_db($con, "login");
//$query ="SELECT user_check_id from loginpage where username='$user' and password='$pass'";
$query ="SELECT * from loginpage where username='$user' and password='$pass'";


//echo $query;

if ($query)
{
    $result = mysqli_query($con,$query);
    $row = mysqli_fetch_array($result);
    if($row["username"]==$user && $row["password"]==$pass)
    {
            echo "Welcome Admin";       
    }
else
        {
            echo"Please Enter the Correct Username/Password...!!";
}
}

?>
请验证此代码:

我使用此代码登录:

如果用户提供了正确的凭据-如果部件正常工作, 如果没有,那么其他部分将是工作

<?php
 // Grab User submitted information
$user = $_POST["username"];
$pass = $_POST["password"];

//$uc_id=$_GET["user_check_id"];


// Connect to the database
$con = mysqli_connect("localhost","root","pass123");
// Make sure we connected successfully
if(! $con)
{
    die('Connection Failed'.mysql_error());
}
// Select the database to use
mysqli_select_db($con, "login");
//$query ="SELECT user_check_id from loginpage where username='$user' and password='$pass'";
$query ="SELECT * from loginpage where username='$user' and password='$pass'";


//echo $query;

if ($query)
{
    $result = mysqli_query($con,$query);
    $row = mysqli_fetch_array($result);
    if($row["username"]==$user && $row["password"]==$pass)
    {
            echo "Welcome Admin";       
    }
else
        {
            echo"Please Enter the Correct Username/Password...!!";
}
}

?>


在查询中在$password周围加上单引号,然后再试。

在查询中在$password周围加上单引号,然后再试。

脚本在哪里?我看不到任何代码。请把你的代码放好,这样我们就可以识别错误。他贴了一张编辑没有看到的图片。请用代码编辑问题。请不要张贴代码图像。编辑你的问题并发布代码。我看不懂那个小文本。脚本在哪里?我看不到你的任何代码。请把你的代码放好,这样我们就可以识别错误。他贴了一张编辑没有看到的图片。请用代码编辑问题。请不要张贴代码图像。编辑你的问题并发布代码。我看不懂那篇小文章。哦,我现在知道了,我将更新我的答案。请稍候。如果我回答了你的问题,请接受它作为答案,并竖起大拇指,谢谢。很高兴有帮助。哦,我现在知道了,我会更新我的答案,请稍候。如果我回答了你的问题,请接受它作为答案,竖起大拇指谢谢。很高兴能帮上忙。添加了单引号,但仍然。。。任何用户都可以使用添加了单引号的任何密码登录,但仍然。。。任何用户都可以使用任何密码登录