/** * Process user login * * @param unknown_type $login * @return unknown */ function process_user_login($login = NULL, $email_login = false) { if (!is_array($login) || 0 >= count($login)) { return FALSE; } $emailid = $login['email']; $password = @$login['password']; $this->CI->db->select("email AS EMAIL, id as USERID, first_name as FIRST_NAME, last_name as LAST_NAME, status as STATUS, activation_code as ACT_CODE, profile_image"); if (!empty($login['user_id'])) { $this->CI->db->where('id', $login['user_id']); } else { if ($email_login == true) { $this->CI->db->where('email', $emailid); $this->CI->db->where(" 'status' != '4' "); } else { $this->CI->db->where('email', $emailid); $this->CI->db->where(" 'status' != '4' "); $password = $this->CI->db->escape_like_str($password); $password = '******' . $password; $this->CI->db->where("`password` = (SELECT SHA2(CONCAT('{$password}',`encrypt_time`), 256))", NULL, false); } } $select_query = $this->CI->db->get('user_details'); //echo($this->CI->db->last_query()); exit; if (0 < $select_query->num_rows()) { $row = $select_query->row(); if ($row->STATUS == 1 && $row->ACT_CODE == NULL) { $this->CI->db->where('id', $row->USERID); $arr['last_login_date'] = get_cur_date_time(); $this->CI->db->update('user_details', $arr); $session_data = array('USER_EMAIL' => $row->EMAIL, 'FIRST_NAME' => $row->FIRST_NAME, 'LAST_NAME' => $row->LAST_NAME, 'USER_ID' => $row->USERID, 'USER_STATUS' => $row->STATUS, 'USER_PROFILE_IMAGE' => $row->profile_image, 'last_activity' => time()); $this->CI->session->set_userdata($session_data); return 'success'; } else { if ($row->STATUS == 3 || $row->STATUS == 2) { return 'blocked'; } else { if ($row->STATUS == 4) { return 'deleted'; } else { if ($row->ACT_CODE != NULL) { return 'emailactivation'; } else { return 'inactive'; } } } } } return false; }
function is_start_date_over($from_date) { $curr_date = get_cur_date_time(); if (strtotime($curr_date) > strtotime($from_date)) { return true; } else { return false; } }