| Server IP : 103.48.194.25 / Your IP : 216.73.217.33 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/nguyenlieumyphamgiasi.vn/public_html/webadmin/models/ |
Upload File : |
<?php
class member_model extends CI_Model
{
function __construct()
{
parent::__construct();
//$this->load->library('mail_library');
}
function getAllMember($num=30,$offset=0)
{
$this->db->order_by('customer.cusid','DESC');
$query = $this->db->get('customer',$num,$offset);
return $query->result();
}
function getNumMember()
{
$query = $this->db->get('customer');
return $query->num_rows();
}
// Random salt
function salt($length = 30)
{
$salt = '';
for ($i = 0; $i < $length; $i++)
{
$salt .= chr(rand(33, 126));
}
return $salt;
}
//Save Member
function savemember()
{
$cusname = $this->input->post('cusname');
$cuspass = md5($this->input->post('cuspass'));
$cusmail = $this->input->post('cusmail');
$bl_active = $this->input->post('bl_active');
$data = array(
'cusmail' => $cusmail,
'cusname' => $cusname,
'cuspass' => $cuspass,
'bl_active' => $bl_active,
'cusname' => (string)$this->input->post('cusname'),
'cusphone' => (string)$this->input->post('cusphone'),
'address' => (string)$this->input->post('address'),
);
if($this->db->insert('customer',$data)){
return true;
}else{
return false;
}
}
// Get Thanh vien
function get_info_member()
{
$id = $this->uri->segment(3);
$this->db->where('cusid',$id);
$query = $this->db->get('customer');
return $query->row();
}
function get_bid_by_member($cusid)
{
$this->db->where('cusid',$cusid);
return $this->db->get('customer_bid')->row();
}
//save Update
function saveupdate()
{
$cusid = $this->input->post('cusid');
$cusname = $this->input->post('cusname');
$cuspass = md5($this->input->post('cuspass'));
$cusmail = $this->input->post('cusmail');
$bl_active = $this->input->post('bl_active');
$data = array(
'cusname' => $cusname,
'cusmail' => $cusmail,
'cuspass' => $cuspass,
'bl_active' => $bl_active,
'cusphone' => $this->input->post('cusphone'),
'address' => $this->input->post('address')
);
$data_no_pass = array(
'cusname' => $cusname,
'cusmail' => $cusmail,
'bl_active' => $bl_active,
'cusphone' => $this->input->post('cusphone'),
'address' => $this->input->post('address')
);
$this->db->where('cusid',$cusid);
if($this->db->update('customer',($this->input->post('cuspass')!='') ? $data : $data_no_pass)){
return true;
}else{
return false;
}
}
function delete($id)
{
$this->db->where('cusid',$id);
$query = $this->db->delete('customer');
if($query){
$this->db->where('cusid',$id);
$this->db->delete('customerextra');
return true;
}else{
return false;
}
}
function getAllTimkiem($num,$offset,$key,$tuychon){
if($tuychon!='' || $key!=''){
if($tuychon=='user_login'){
$this->db->like('user_login',$key);
}else{
$this->db->like('user_cusname',$key);
}
}
$query = $this->db->get('users',$num,$offset);
return $query->result();
}
function getNumTimkiem($key,$tuychon){
if($tuychon!='' || $key!=''){
if($tuychon=='user_login'){
$this->db->like('user_login',$key);
}else{
$this->db->like('user_cusname',$key);
}
}
$query = $this->db->get('users');
return $query->num_rows();
}
function get_all_city(){
$this->db->where('CountryID',1);
return $this->db->get('city')->result();
}
function get_city_by_id($CityID) {
$this->db->where('CityID',$CityID);
$check = $this->db->get('city')->row();
return ($check)?$check->CityName:'';
}
/**************
* Thong ke
*/
function get_thongke(){
$tungay = $this->input->post('tungay');
$denngay = $this->input->post('denngay');
$order = $this->input->post('order');
$order_type = $this->input->post('order_type');
$datebegin = strtotime($tungay);
$dateend = strtotime($denngay);
$this->db->where('RegisteredDate >',$datebegin);
$this->db->where('RegisteredDate <',$dateend);
$this->db->order_by($order,$order_type);
return $this->db->get('customer')->result();
}
}
?>