public function user_userfieldshop_post() { $data = $this->data; //取得公用數據 $this->form_validation->set_rules('receive_name_Str', '常用收件人姓名', 'required'); $this->form_validation->set_rules('receive_phone_Str', '常用收件人電話', 'required'); $this->form_validation->set_rules('receive_address_Str', '常用收件人地址', 'required'); $uid_Num = $this->input->post('uid_Num', TRUE); if ($this->form_validation->run() !== FALSE) { //基本post欄位 $receive_name_Str = $this->input->post('receive_name_Str', TRUE); $receive_phone_Str = $this->input->post('receive_phone_Str', TRUE); $receive_address_Str = $this->input->post('receive_address_Str', TRUE); //建構User物件,並且更新 $UserFieldShop = new UserFieldShop(); $UserFieldShop->construct(array('uid_Num' => $uid_Num, 'receive_name_Str' => $receive_name_Str, 'receive_phone_Str' => $receive_phone_Str, 'receive_address_Str' => $receive_address_Str)); $UserFieldShop->update(array('db_update_Arr' => array('user_field_shop.receive_name', 'user_field_shop.receive_phone', 'user_field_shop.receive_address'))); //送出成功訊息 $this->load->model('Message'); $this->Message->show(array('message' => '設定成功', 'url' => 'admin/user/global/global_shop/user')); } else { $validation_errors_Str = validation_errors(); $validation_errors_Str = !empty($validation_errors_Str) ? $validation_errors_Str : '設定錯誤'; $this->load->model('Message'); $this->Message->show(array('message' => $validation_errors_Str, 'url' => 'admin/user/global/global_shop/user')); } }
public function delete() { $hash_Str = $this->input->get('hash'); $uid_Num = $this->input->get('uid'); $uid_Arr = $this->input->post('uid_Arr[]'); if (empty($uid_Arr) && empty($uid_Num)) { $this->load->model('Message'); $this->Message->show(array('message' => '未選擇要刪除的會員', 'url' => 'admin/base/user/user_shop/tablelist')); } //CSRF過濾 if ($hash_Str == $this->security->get_csrf_hash()) { if (!empty($uid_Num)) { $User = new UserFieldShop(['uid_Num' => $uid_Num]); $User->delete(); } if (!empty($uid_Arr)) { foreach ($uid_Arr as $key => $value_uid) { $User = new UserFieldShop(['uid_Num' => $value_uid]); $User->delete(); } } $user_User = new UserFieldShop(); $user_User->construct(array('uid_Num' => $uid_Num)); $user_User->delete(); $this->load->model('Message'); $this->Message->show(array('message' => '刪除成功', 'url' => 'admin/base/user/user_shop/tablelist')); } else { $this->load->model('Message'); $this->Message->show(array('message' => 'hash驗證失敗,請使用標準瀏覽器進行刪除動作', 'url' => 'admin/base/user/user_shop/tablelist')); } }