我无法登录。单击按钮登录时,它显示错误的用户名或密码。数据库是 id、用户名、密码和级别。选择id
, username
, password
,level
从login
<?php
ob_start();
$message = "";
if ( isset ($_POST['login']))
{
include 'admin/dbconnect.php';
$username = $_POST['username'];
$password = $_POST['password'];
if ($username != "" && $password != "")
{
$sql = "SELECT * FROM login WHERE username = '$username' and password = '$password' ";
$result = mysql_query($sql) ;
$row = mysql_fetch_array($result, MYSQL_ASSOC);
if (mysql_num_rows($result) ==1)
{
session_start();
$_SESSION['isLogged_in'] = true;
$_SESSION['username'] = $row['username'];
$_SESSION['level'] = $row['level'];
$message = 'Logged-in successfully';
}
else
{
$message = 'WRONG USERNAME OR PASSWORD';
}
}
else
{
$message = 'PLEASE RE-INPUT YOUR USERNAME AND PASSWORD';
}
}
?>