Hi guys,
Im having a hard tym on this already. I wanted to get the usertype base on the email. I have 2 records
usertype email password
1 [email protected] admin1
2 [email protected] admin2
here is my code
public function signinAction(){
Tag::appendTitle(' | Sign in');
/**
* include file forms/LoginForm.php
*
*/
self::$signin_form = new LoginForm;
$this->view->form = self::$signin_form;
if(self::$hit->isPost()){
$this->signinvalidateAction();
}
}
private function signinvalidateAction(){
self::$email = self::$hit->getPost('lf_email', ['string', 'striptags']);
self::$password = self::$hit->getPost('lf_password', ['string', 'striptags', 'trim']);
switch(self::$signin_form){
case (self::$signin_form->isValid($_POST)):
$checkuser = TblUser::findFirstByEmail(self::$email);
if($checkuser) {
if (self::$hash->checkHash(self::$password, $checkuser->password)) {
parent::__beginsession(self::$email);
$check_usertype = TblUser::findFirst($checkuser);
$result_usertype = $check_usertype->user_type_fk;
echo $result_usertype;
//$this->response->redirect('dashboard');
}
else{
echo $this->flash->error("Invalid email/password");
}
}
break;
default:
foreach (self::$signin_form->getMessages() as $message){
echo $this->flash->error($message);
}
break;
}
}
the problem is it shows usertype is 1 even if i logged admin2
thnks guys