Пример #1
0
 function edit_profile()
 {
     $this->load->library('hash');
     $person_id = $this->phpsession->get('personVO')->getPerson_id();
     $data = array('email' => $this->input->post('email'), 'first_name' => $this->input->post('fname'), 'last_name' => $this->input->post('lname'), 'img_size' => $this->input->post('img_size'), 'sort_ord' => $this->input->post('sort_ord'), 'addr1' => $this->input->post('ship_addr1'), 'addr2' => $this->input->post('ship_addr2'), 'city' => $this->input->post('ship_city'), 'state' => $this->input->post('ship_state'), 'zip' => $this->input->post('ship_zip'), 'country' => $this->input->post('ship_country'));
     if ($this->input->post('opassword', TRUE) != "") {
         $this->db->select('person_id, password');
         $this->db->where('person_id', $person_id);
         $query = $this->db->get('person');
         $row = $query->result_array();
         if ($query->num_rows == 1 && Hash::CheckPassword($this->input->post('opassword'), $row[0]['password'])) {
             $data['password'] = Hash::HashPassword($this->input->post('npassword'));
         } else {
             echo "Old password was not correct.";
         }
     }
     $this->db->where('person_id', $person_id);
     $query = $this->db->update('person', $data);
     if ($query) {
         $this->phpsession->get('personVO')->setFname($this->input->post('fname'));
         $this->phpsession->get('personVO')->setLname($this->input->post('lname'));
         $this->phpsession->get('personVO')->setEmail($this->input->post('email'));
         $this->phpsession->get('personVO')->setImg_size($this->input->post('img_size'));
         $this->phpsession->get('personVO')->setSort_ord($this->input->post('sort_ord'));
         $this->phpsession->get('personVO')->setAddr1($this->input->post('ship_addr1'));
         $this->phpsession->get('personVO')->setAddr2($this->input->post('ship_addr2'));
         $this->phpsession->get('personVO')->setCity($this->input->post('ship_city'));
         $this->phpsession->get('personVO')->setState($this->input->post('ship_state'));
         $this->phpsession->get('personVO')->setZip((int) $this->input->post('ship_zip'));
         $this->phpsession->get('personVO')->setCountry($this->input->post('ship_country'));
         echo true;
     } else {
         echo false;
     }
 }
Пример #2
0
 function _hash_password($field)
 {
     $this->{$field} = Hash::HashPassword($this->{$field});
 }