Created
July 29, 2011 04:43
-
-
Save alex-zige/1113145 to your computer and use it in GitHub Desktop.
Customized Login control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function signup($data,$form){ | |
Debug::show($data); | |
//get the Rego and Password | |
$rego=$data['RegoNo']; | |
$pwd=$data['Password']; | |
$flag=$this->validuser($rego,$pwd); | |
Debug::show($flag); | |
if ($flag !=true) | |
{ | |
$msg="password wrong or wrong username"; | |
//Warning:: password wrong or wrong username | |
return $this->renderWith(array('Error','Page')); | |
}else{ | |
// true | |
//Save Into Session Object | |
Session::set('Login', true); | |
Director::redirect('/iwi-register'); | |
} | |
} | |
public function validuser($rego,$password) | |
{ | |
Debug::show($password); | |
//do database query | |
$selecte_user = DataObject::get_one('User',"RegNo = '".$rego."'",'','',''); | |
Debug::show($selecte_user); | |
if (isset($selecte_user)) | |
{ | |
//testing password | |
$pwdInsystem=$selecte_user->Password; | |
Debug::show($pwdInsystem); | |
return ($pwdInsystem == $password) ? true : false ; | |
}else { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment