Xtremer360 Posted February 29, 2012 Share Posted February 29, 2012 When I submit the login form its not returning anything and it was working until I added in the $remember part so I'm wondering why its still not returning TRUE. /** * Login user on the site. Return TRUE if login is successful * (user exists and activated, password is correct), otherwise FALSE. * * @param string * @param string * @param int * @return bool */ function login($username, $password, $remember) { $this->ci->load->model('kow_auth/users'); $user_data = $this->ci->users->get_user_by_username($username); if ($user_data) { $regenFromPostPW = $this->ci->genfunc->reGenPassHash($password, $user_data->password2); if ($regenFromPostPW == $user_data->password) { $this->ci->session->set_userdata(array( 'xtr' => 'yes', 'user_id' => $user_data->user_id, 'username' => $user_data->username, 'status' => $user_data->users_statuses_id, 'role' => $user_data->users_roles_id )); if ($remember == 1) { $timeTOexpire = time()+(60*60*24*31*2); $this->input->set_cookie('xtrcook', '1', $timeTOexpire); } else { $cookie = trim(get_cookie('xtrcook')); if ($cookie || is_numeric($cookie)) { delete_cookie('xtrcook'); } } $this->clear_login_attempts($user_data->user_id); $this->ci->users->insert_session($this->ci->session->userdata('session_id'), $this->ci->session->userdata('user_id'), $this->ci->genfunc->getRealIpAddr(), $this->ci->genfunc->getUserOS()); return TRUE; } else { $this->increase_login_attempt($user_data->user_id); } } else { return NULL; } } Quote Link to comment https://forums.phpfreaks.com/topic/258012-no-response-returned/ Share on other sites More sharing options...
codebyren Posted March 1, 2012 Share Posted March 1, 2012 Your function doesn't return TRUE or FALSE in all cases. In particular: <?php if ($regenFromPostPW == $user_data->password) { // Your code here returns TRUE } else { $this->increase_login_attempt($user_data->user_id); // No return value here so you're probably ending up with NULL. } ?> Quote Link to comment https://forums.phpfreaks.com/topic/258012-no-response-returned/#findComment-1322544 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.