<?php
class Login extends CI_Model {
    

    function __construct()
    {        
        parent::__construct();
    }
	
	public function cek_siswa($u, $s)
    {
		$this->d_pas = $this->load->database('default', TRUE);
		$query = $this->d_pas->query("select * from at_login where username='$u' and sandi=md5('$s') ");
        $b=$query->num_rows();
		return $b;
    }
	
	public function cek_login_siswa($u)
    {
			$this->d_pas = $this->load->database('default', TRUE);
			$query = $this->d_pas->query("select * from at_login where username='$u'");
            $b=$query->num_rows();
			
			if($b =="0"){
			echo "<script>alert('Maaf anda belum login')</script>";
			echo"<html><head><meta http-equiv='refresh' content='0;url=".base_url()."index.php/depan/logout'></head><body></body></html>";
			exit;
			}
    }
	
}