nel db ho creato un tente impostando la password con lo sha1.
per fare il login:
Codice PHP:
    public function login($user$pass) {
        
$strQuery "SELECT * FROM user WHERE user_name='" trim($user) . "' AND user_password='" trim(sha1($pass)) . "'";
        try {
            
$query $this->pdo->prepare($strQuery);
            
$query->execute();
            if (
$query->rowCount() == 1) {
                
$_SESSION['login_eseguito'] = TRUE;
                
$_SESSION['user_id'] = $result->user_id;
                return 
TRUE;
            } else {
                return 
FALSE;
            }
        } catch (
PDOException $e) {
            print 
"Error!: " $e->getMessage() . "
"
;
            die();
        }
    } 
mi dice sempre che i dati sono sbagliati.
i dati gli arrivano da qua:
Codice PHP:
<?php
session_start
();
include_once 
'config.php';
$obj = new Config();
if (
$obj->verifica_sessione()) {
    
header("location:index.php");
}
if (
$_SERVER["REQUEST_METHOD"] == "POST") {
    
$login $obj->login($_POST['username'], $_POST['password']);
    if (
$login) {
        
header("location:index.php");
    } else {
        echo 
'I dati indicati non sono corretti.';
    }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Login</title>
    </head>
    <body>
<?php
include_once 'menu.php';
?>
        <table>
            <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
                <tbody>
                    <tr>
                        <td>User:</td>
                        <td><input type="text" name="username" value="" /></td>
                    </tr>
                    <tr>
                        <td>Password:</td>
                        <td><input type="password" name="password" value="" /></td>
                    </tr>
                    <tr>
                        <td><input type="submit" value="Send" /></td>
                    </tr>
            </form>
        </table>
    </body>
</html>