CodeIgniter Forums
please help with active user select - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: please help with active user select (/showthread.php?tid=560)



please help with active user select - udin_ordinary - 12-18-2014

dear all,

please help me with this script

if ($this->form_validation->run() != FALSE){// echo 'valid';
$valid_user = $this->auth->trylogin($this->input->post("email"), $this->input->post("password"));


if(!$valid_user) {
$msg = '<div style="color: red;font-family:Letter Gothic Std;font-size: 12px;">' . lang('login_error') . '</div>';
}
if($active = 0)) {
$msg = 'your account is not active';
}


else {
redirect('product/catalogue');

}
}

i wanna make login check with active user alert.
please help me ....

thank you


RE: please help with active user select - Rufnex - 12-18-2014

What will you do with the variable $msg? Print it out ( echo $msg; ) or put it into a view .. ? In your i second if-statement you have to check the value with ($active == 0) ...

But if your return value is "false" on your login check you have to test for the correct type otherwise (like your e.g.) !$valid_user is the same as $active == 0 so both statements get true. And if your login check gives you also an active status with 0 or 1 back you have to check something like that:

PHP Code:
if ($valid_user === false) { echo "wahhhh"; }
if (
$valid_user == 0) { echo "no active"; } 

So other question is, where comes your $active variable?


RE: please help with active user select - udin_ordinary - 05-08-2016

Rufnex -> thank you rufnex.