| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/adeetie/application/models/ |
Upload File : |
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Mappuser extends CI_Model{
protected $tableName = 'users';
function usermodel() {
return array(
'first_name' => $this->input->post('first_name'),
'last_name' => $this->input->post('last_name'),
'company_phone' => $this->input->post('company_phone'),
'designation' => $this->input->post('designation'),
'company' => $this->input->post('company')
);
}
function update_user($id) {
$arr = $this->usermodel();
if(!empty($this->input->post('password'))) {
$arr['password'] = password_hash($this->input->post('password'), PASSWORD_DEFAULT);
}
$this->db->where('id', $id);
$this->db->update( $this->tableName, $arr );
if( $this->db->affected_rows() > 0 ) {
$this->session->set_flashdata( 'message','Successfully Updated' );
redirect('bank/profile', 'refresh');
} else {
$this->session->set_flashdata('error','Updation failed');
redirect('bank/profile', 'refresh');
}
}
function update_password($id) {
$arr = [];
$arr['password'] = password_hash($this->input->post('new_password'), PASSWORD_DEFAULT);
$this->db->where('id', $id);
$this->db->update( $this->tableName, $arr);
if( $this->db->affected_rows() > 0 ) {
$this->session->set_flashdata( 'message','Password Successfully Updated' );
redirect('bank/bank', 'refresh');
} else {
$this->session->set_flashdata('error','Updation failed');
redirect('bank/bank', 'refresh');
}
}
function get_user_byid($id) {
$this->db->where('id', $id);
$sql = $this->db->get($this->tableName);
if ($sql->num_rows() > 0) {
return $sql->row();
}
}
function get_userarray_byid($id) {
$this->db->where('id', $id);
$sql = $this->db->get($this->tableName);
if ($sql->num_rows() > 0) {
return $sql->row_array();
}
}
}