<?php
class proseslogin{
    
    function login($username,$password){
        $login=mysql_query("SELECT users.* ,detail_user.id_user FROM users ,detail_user WHERE users.username = detail_user.username AND users.username='$username' AND users.password='$password' AND users.blokir='N'");
        $n=mysql_num_rows($login);
        $r=mysql_fetch_array($login);
        
        $data = array(
                        'id' => $r[id_user],
                        'nama' => $r[nama_lengkap],
                        'username' => $r[username],
                        'password' => $r[password],
                        'level' => $r[id_level],
                        'status' => $r[status],
                        'n' => $n
                     );
        
        return($data);
    }
    
    function session($id,$username){
        mysql_query("UPDATE users SET id_session='$sid' WHERE username='$username'");
    }
}

