Exemplo n.º 1
20
 public function myAccount()
 {
     if (isset($this->session->userdata["user_id"])) {
         $data = array();
         $model = new Common_model();
         $user_id = $this->session->userdata["user_id"];
         $username = $this->session->userdata["user_username"];
         if ($this->input->post()) {
             $arr = $this->input->post();
             //                prd($arr);
             if (isset($arr["btn_submit"])) {
                 $user_dob = NULL;
                 if (!empty($arr['dob_dd']) && !empty($arr['dob_mm']) && !empty($arr['dob_yy'])) {
                     $user_dob = $arr['dob_yy'] . '-' . $arr['dob_mm'] . '-' . $arr['dob_dd'];
                 }
                 $location_details = get_location_details_from_google(trim($arr['user_location']));
                 $location_lat_long = getLatLonByAddress(trim($arr['user_location']));
                 $data_array = array('user_fullname' => addslashes($arr['user_fullname']), 'user_gender' => addslashes($arr['user_gender']), 'user_location' => addslashes($arr['user_location']), 'user_city' => $location_details['city'], 'user_state' => $location_details['state'], 'user_country' => $location_details['country'], 'user_location' => trim($arr['user_location']), 'user_latitude' => $location_lat_long['latitude'], 'user_longitude' => $location_lat_long['longitude'], 'user_tagline' => addslashes($arr['user_tagline']), 'user_about' => addslashes($arr['user_about']), 'user_relationship_status' => addslashes($arr['user_relationship_status']), 'user_dob' => $user_dob);
                 if (isset($arr['user_username'])) {
                     $username = trim($arr['user_username']);
                     $checkUsername = $model->is_exists("user_id", TABLE_USERS, array("username" => $username, "user_id !=" => $user_id));
                     if (!empty($checkUsername)) {
                         $this->session->set_flashdata("error", "That username is already taken. Please choose another.");
                     } else {
                         $data_array['user_username'] = $username;
                         $data_array['user_changed_username'] = '******';
                     }
                 }
                 $this->session->set_flashdata("success", "Personal details updated successfully");
                 $model->updateData(TABLE_USERS, $data_array, array("user_id" => $user_id));
                 // updating redis keys now
                 $this->redis_functions->set_user_profile_data($username);
                 @$this->session->set_userdata("user_fullname", trim($arr["user_fullname"]));
                 @$this->session->set_userdata("user_username", $username);
             }
             redirect(base_url('my-account'));
         } else {
             $record = $this->redis_functions->get_user_profile_data($username);
             $page_title = $record["user_fullname"];
             $input_arr = array(base_url() => 'Home', '#' => $page_title);
             $breadcrumbs = get_breadcrumbs($input_arr);
             $data["record"] = $record;
             $data["breadcrumbs"] = $breadcrumbs;
             $data["page_title"] = $page_title;
             $data['meta_title'] = $data["page_title"] . ' - ' . $this->redis_functions->get_site_setting('SITE_NAME');
             $this->template->write_view("content", "pages/user/my-account", $data);
             $this->template->render();
         }
     } else {
         require_once APPPATH . 'controllers/index.php';
         $index_controller = new Index();
         $index_controller->login();
     }
 }
Exemplo n.º 2
0
 public function add_new($step = 1, $url_key = NULL)
 {
     if (isset($this->session->userdata["user_id"])) {
         $data = array();
         $user_id = $this->session->userdata["user_id"];
         $model = new Common_model();
         switch ($step) {
             case 1:
                 // meta info
                 $this->add_new_step_one($url_key);
                 break;
             case 2:
                 // regions
                 $this->add_new_step_two($url_key);
                 break;
             case 3:
                 // budgets
                 $this->add_new_step_three($url_key);
                 break;
             case 4:
                 // media
                 $this->add_new_step_four($url_key);
                 break;
         }
     } else {
         require_once APPPATH . 'controllers/index.php';
         $index_controller = new Index();
         $index_controller->login();
     }
 }
Exemplo n.º 3
0
 /**
  * ログイン処理
  * route --> /customer
  */
 public function indexAction()
 {
     $this->_log->debug(__CLASS__ . ":" . __FUNCTION__ . " called:(" . __LINE__ . ")");
     $chk = Auth::loginCheck();
     if ($chk != false) {
         $this->_log->debug('ログインしています.');
         $this->redirect('/item');
         return;
     }
     /** セッション情報が無い場合 **/
     $params = $this->getPostList();
     if (count($params) == 0) {
         $this->_log->debug("パラメータがPOSTされていません.");
         return;
     }
     $chechItem = array("email" => "NotNull", "password" => "NotNull");
     $mapper = new Index();
     $result = $mapper->login($params);
     if ($result === true) {
         $this->_log->debug("ログイン失敗.");
         return;
     }
     $this->redirect('/item');
 }