questo è il login:

uso il sistema PDO.
codice:
<?php    
    include("inc.php");
    session_start();
    if(isset($_POST['login'])){


    $password = $_POST["password"];


    
    $username =  $_POST['username'];
    
    if(empty($username))
    {
        $error = "Username non inserito";
        
    }elseif(empty($password))
    {
        $error = "Password non inserita";
    }
    else
    {
        $md5_password = md5($_POST["password"]);
        $query = $db->prepare("SELECT * FROM users WHERE username=:username AND password=:password");
        $query->bindParam(':username', $_POST['username']);
        $query->bindParam(':password', $md5_password);


       $query->execute();


        if($row = $query->fetch()){
            $_SESSION['username'] = $row['username'];
            $_SESSION['level_access'] = $row['level_access'];
            $_SESSION["login"] =true;
            header("Location: index.php");
        }else
        {
            echo 'ERROR';
        }
    }
}
?>
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<title>Login</title>
</head>
<link href="css/admin.css" rel="stylesheet" type="text/css">
<body>
<div id="admin">
<h2>Amministratore</h2>
<img src="img/login.png">
<br /><br />
<?php
  if(isset($error)){ echo "<p class=\"info_error\">".$error."</p>";}
if(isset($msg)){ echo $msg;} else {
?>
<form method="POST">
<table align="center">
<tr>
<td>Username</td>
<td><input type="text" name="username" value="<?php if(isset($_POST['username'])){echo htmlspecialchars($_POST['username']);}?>"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" value="<?php if(isset($_POST['password'])){echo htmlspecialchars($_POST['password']);}?>"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="login" value="Accedi"></td>
</tr>
</table>
</form>
<?php
}
?>
<p><a href="forgot.php">Recupera Password</a></p>
</div>
</body>
</html>
non so se c'entra questo.....

grazie mille.