PHP Code:
<?php
    
class Login{
        private 
$Table;
        private 
$Structure;
        
        function 
__construct($Table=""$Structure=""){
            
$this->Table = ($Table) ? $Table "accounts";
            
$this->Structure = ($Structure) ? $Structure : Array("name""password""salt");
        }
        
        function 
__destruct(){
            unset(
$this->Table);
            unset(
$this->Structure);
            unset(
$this);
        }
        
        function 
Login($Username$Password){
            global 
$MySQL;
            
            
$Username $MySQL->Escape($Username);
            
$Password $MySQL->Escape($Password);
            
            
$MySQL->Query("SELECT `{$this->Structure['0']}`, `{$this->Structure['1']}`, `{$this->Structure['2']}` FROM `{$this->Table}` WHERE `{$this->Structure['0']}` = '{$Username}';");
            
            if(
$Row $MySQL->Fetch_Array()){
                if((
sha1($Password $Row[$this->Structure['2']])) == $Row[$this->Structure['1']]){
                    return 
true;
                }
            }
            
            return 
false;
        }
    }
?>

Password stored in database must be hashed with SHA-1.

It is flexible so it uses any table and any field names.