Look over my code for PDO and MVC I'm building this website with PDO and Pattern MVC.  I'm currently working on the login page and would like to know if this structure is correct for MVC pattern.  I'd also like your opinions and advice on this.

For my login view I have:

&lt;form action="test.php" name="loginform" method="post"&gt;
    &lt;input type="text" name="login"&gt;
    &lt;input type="password" name="password"&gt;
    &lt;input type="submit" name="login_submit" value="Se connecter"&gt;
&lt;/form&gt;


For my login controller I have:

if(isset($_POST['login_submit'])){
    if(!empty($_POST['login']) &amp;&amp; !empty($_POST['password'])){
        $auth = new auth();
        $auth-&gt;setLogin($_POST['login']);
        $auth-&gt;setPassword(md5(sha1($_POST['password'])));
        if(($row = $auth-&gt;login('u_login,u_email,u_id_level', 'users', 'u_login', 'u_password'))){                 
            $_SESSION['back_office'] = array(
                'login' =&gt; $row-&gt;u_login,
                'email' =&gt; $row-&gt;u_email,
                'level' =&gt; $row-&gt;u_id_level
            );
        }else{
            message::showError('Compte non reconnu');
        }
    }else{
        message::showError('Veuillez remplir tous les champs');
    }
}


For my login model I have:

class auth{
    protected $rowUser;
    protected $login;
    protected $password;
    protected $email;

    public function setLogin($login){
        $this-&gt;login = $login;
    }
    public function setPassword($password){
        $this-&gt;password = $password;
    }
    /**
     * @return array $row
     */
    public function login($fields, $table, $col_login, $col_password){
        $query = Db::getInstance()-&gt;prepare('SELECT '.$fields.' FROM '.$table.' WHERE '.$col_login.' = :login AND '.$col_password.' = :password');
        $query-&gt;bindValue(':login',$this-&gt;login,PDO::PARAM_STR);
        $query-&gt;bindValue(':password',$this-&gt;password,PDO::PARAM_STR);
        $query-&gt;execute();
        if($query-&gt;rowCount() &gt; 0){
            $row = $query-&gt;fetch();
            return $row;
        }else{
            return false;
        }
        $query-&gt;closeCursor();
    }    
}
A part of code in auth::login() of method you should move to other class, for example 'db'. Because you class auth has too much responsibility. For example if you want to have dynamic define fields in class auth:

Db class:

class db {
    public function getItem($table, $fields = '*', $conditions = array()) {
        // you code ...
        return $row;
    }
}


Your model:

class auth {
    private $table = 'users';
    private $fields = 'u_login, u_email, u_id_level';
    private $fieldLogin = 'u_login';
    private $fieldPassword = 'u_password';

    public function setTable($value) { $this-&gt;table = $value; }
    public function setFields($value) { $this-&gt;fields = $value; }
    public function setFieldLogin($value) { $this-&gt;fieldLogin = $value; }
    public function setFieldPassword($value) { $this-&gt;fieldPassword = $value; }

    public function login() {
        $db = new db();
        return $db-&gt;getItem($this-&gt;table, $this-&gt;fields, array(
            $this-&gt;fieldLogin =&gt; $this-&gt;login,
            $this-&gt;fieldPassword =&gt; $this-&gt;password
        ));
    }   
}


This code is more elastic and simpler will be change it.