Php应用程序登录失败

Cod*_*Mat 2 html php login

我是PHP新手并开发一个登录表单.请在下面找到我使用的代码.我想要登录work.please帮助我.

config.php文件

<?php

$dbUser="root";
$dbPassword="";
$dbName="forsitelogin";
$dbHost="localHost";

$dbConnection= mysql_connect($dbHost, $dbUser, $dbPassword);

if($dbConnection)
{
    mysql_select_db($dbName);
    print("Sucessfully connected to database");
}
else
    die("<strong>Cound not connect to database </strong> ");

?>
Run Code Online (Sandbox Code Playgroud)

的index.php

<?php

        require 'config.php';
        require 'thems\login.html';

     ?>
Run Code Online (Sandbox Code Playgroud)

的login.php

<?php
require 'thems\login.html';
  require 'config.php';


$query=mysqli_query($dbConnection,"SELECT * FROM users WHERE email= v AND password=123");


if(mysql_num_rows($query))
{
    die("login sucessfully");
}
 else {
    die("Incorrect password or email");
}


?>
Run Code Online (Sandbox Code Playgroud)

thems/login.html的

    <html>
            <head>
                <title></title>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            </head>
            <body>


 <div>
        <form action=".\login.php" method="post">
Email: <input type="text" name="email"><br>
password: <input type="text" name="pass"><br>

<input type="submit"  id="Submit_button" >

</form>
        </div>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

警告:mysql_query()期望参数1为字符串,资源在第22行的C:\ Program Files\xampp\htdocs\forsiteSystem\login.php中给出

Mah*_*esh 5

Login.php应该如下.

<?php
require 'config.php';
require 'thems\login.html';

$sql="SELECT * FROM users WHERE email='".$_POST['email']."' AND password='".$_POST['pass']."'";

$query=mysql_query($sql) or die(mysql_error());

if(mysql_num_rows($query)){
    die("login sucessfully");
}
else{
    die("Incorrect password or email");
}

?>
Run Code Online (Sandbox Code Playgroud)

index.php应该如下

<?php
   require_once('config.php');
   include('thems\login.html');
?>
Run Code Online (Sandbox Code Playgroud)

您可以尝试以正确的方式学习php.