function process_login()
 {
     $username = addslashes($_POST["admin_email"]);
     $password = addslashes($_POST["admin_password"]);
     $rememberme = isset($_POST["rememberme"]) ? 1 : 0;
     if ($password == "") {
         $password = "******";
     }
     $row = array("admin_email" => $username, "admin_password" => $password, "rememberme" => $rememberme);
     /*if ($this->ldapLogin($username, $password)) {
     			$row["admin_ldap"] = 1;
     		}*/
     //login pakai row credential
     Auth::login($row);
     //kalau sukses
     if (Auth::isLogged()) {
         //load school setting
         // $ss = new Schoolsetting();
         // $ss->loadToSession();
         //redirect
         //Account::setRedirection ();
         Hook::processHook($this->login_hook);
         Redirect::firstPage();
     } else {
         Redirect::loginFailed();
     }
 }
示例#2
0
 public static function cekDanLoginin($msg)
 {
     if (!self::isLogged()) {
         global $params;
         if ($params[1] != "logout") {
             self::indexCheckRemember();
         }
         Redirect::index($msg);
     } else {
         Redirect::firstPage();
     }
     return 0;
 }
 public function process_login_fb()
 {
     $email = $_SESSION['sementara']['admin_email'];
     $fbid = $_SESSION['sementara']['admin_fb_id'];
     if ($fbid == "" || $email == "") {
         Redirect::loginFailed();
     }
     $arr = $this->getWhere("admin_email = '{$email}' AND admin_fb_id='{$fbid}' AND admin_aktiv = 1 ");
     if (count($arr) > 0) {
         //load by login ID
         $obj = $arr[0];
         $row = toRow($obj);
         $this->fill($row);
         if (isset($this->admin_id)) {
             $_SESSION["admin_session"] = 1;
             $_SESSION["account"] = $obj;
             //Update setlastlogin
             self::setLastUpdate($_SESSION["account"]->admin_id);
             //lanjut
             //loading metadata
             $meta = new AccountMeta();
             $meta->getMeta($this->admin_id);
             //now loading roles
             $this->loadRole();
             //set cookie
             Auth::setCookie($this->rememberme, $this->admin_id, $this->admin_email, $this->admin_password);
             //kalau sukses
             if (Auth::isLogged()) {
                 //load school setting
                 // $ss = new Schoolsetting();
                 // $ss->loadToSession();
                 //redirect
                 //Account::setRedirection ();
                 $acl = new AccountLogin();
                 Hook::processHook($acl->login_hook);
                 //login hook doesnt seem to work =>bypass
                 $qp = new QuizPoints();
                 $qp->getPoints();
                 $qp->saveUnsaved();
                 Redirect::firstPage();
             } else {
                 Redirect::loginFailed();
             }
         } else {
             return 0;
         }
     }
 }
 public static function setRedirection()
 {
     /*$account = $_SESSION['account'];
     		switch ($_SESSION['account']->admin_role) {
     			case "admin":
     				//loadData
     				$accountRole = new Admin();
     				$accountRole->getByAccountID($account->admin_id);
     				break;
     			case "supervisor":
     				$accountRole = new Supervisor();
     				$accountRole->getByAccountID($account->admin_id);
     
     				break;
     			case "tatausaha":
     				$accountRole = new Tatausaha();
     				$accountRole->getByAccountID($account->admin_id);
     
     				break;
     			case "guru":
     				$accountRole = new Guru();
     				$accountRole->getByAccountID($account->admin_id);
     
     				break;
     			default:
     				$accountRole = new Murid();
     				$accountRole->getByAccountID($account->admin_id);
     		}
     		//fill the data of the Role
     		$accountRole->fill(toRow($account));
     		//$account->admin_role;
     		$_SESSION['account'] = $accountRole;*/
     //setRedirection
     Redirect::firstPage();
 }