login(); } public function login() { $data = array(); $data["login_message"] = ""; $this->load->library('form_validation'); $this->form_validation->set_rules('username', 'Username', 'required'); $this->form_validation->set_rules('password', 'Password', 'required'); if ($this->form_validation->run() !== false) { $data['username'] = strtolower($this->input->post('username')); // '08174596144'; $data['password'] = $this->input->post('password'); //'7978'; $data['sessionid'] = rand(10000, 99999) . "A" . rand(10000, 99999); $data['action'] = WRENCHBOARD_ACCOUNT_LOGIN; $this->load->model('backend_model'); $out = array(); $res = $this->backend_model->wrenchboard_api($data, $out); $is_live = $this->backend_model->cfgReadChar("system.live"); //print_r($out); if ($res == PHP_LOGIN_OK) { $this->load->model('account_model'); $ret = $this->account_model->username_data($data); if ($res !== false) { $data["login_message"] = "Welcome..."; // yes person has an account $_SESSION['session_id'] = $out["session"]; $_SESSION['username'] = $this->input->post('username'); $_SESSION['name'] = $this->input->post('username'); $_SESSION['firstname'] = $ret->firstname; $_SESSION['lastname'] = $ret->lastname; $_SESSION['email'] = $ret->email; $_SESSION['member_id'] = $ret->id; $_SESSION['log_count'] = 0; $_SESSION['mesaage_count'] = 0; $this->findOffers($_SESSION['email']); $_SESSION['message_snapshot'] = $this->myMessagesSnapshot(); $_SESSION['total_jobs'] = 0; if (trim($ret->profile_pic) == '') { // Show default picture $_SESSION['profile_picture'] = "../smedia/DEFAULTS/default-profile.png"; } else { // show the profile picture $_SESSION['profile_picture'] = "../smedia/" . ($is_live ? "LIVE" : "TEST") . "/profile/" . $ret->profile_pic; } $this->logUser('Account login'); $this->refreshAccountDetail($_SESSION['member_id']); // $this->getSessionArray(); redirect('mobile/mobiledash'); } } else { //$data["login_message"] = "