%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/public_html/website_1ec2d7c2/apps/models/ |
Upload File : |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class User_Model extends CI_Model {
public function CheckGoogledata($email,$first_name,$last_name,$picture,$verified_email,$google_id){
$this->db->select("*");
$this->db->from('bh_users');
$this->db->where(array("email_id"=>$email,"google_id"=>$google_id));
$query=$this->db->get();
$datachk=$query->row_array();
if($datachk['email_id']!=""){
$this->session->set_userdata('front_logged_in', '1');
$this->session->set_userdata('bh_front_user_id', $datachk["user_id"]);
$this->session->set_userdata('bh_front_email_id', $datachk["email_id"]);
$this->session->set_userdata('bh_front_username', $datachk["first_name"]);
$this->session->set_userdata('bh_google_src', $datachk["picture"]);
return 'myaccount';
}else {
$data = array(
'first_name' => $first_name,
'last_name' => $last_name,
'email_id' => $email,
'password' => md5($first_name),
'google_id' => $google_id,
'picture' => $picture,
'verified_email' => $verified_email,
'verify_key' => '',
'status' => '1'
);
$this->db->insert('bh_users', $data);
$User_id = $this->db->insert_id();
/* Send Admin Email */
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from(FROM_EMAIL, FROM_NAME);
$this->email->to(ADMIN_EMAIL_ID);
$this->email->cc(CC_EMAIL_ID);
//$this->email->bcc('them@their-example.com');
$this->email->subject('New Account Created | '.WEBSITE_EMAIL_TITLE);
$message = '<h2>'.WEBSITE_EMAIL_TITLE.'</h2>';
$message .= '<p>'.$first_name.' have registered with Us.</p>';
$message .= '<p>Name: '.$first_name.' '.$last_name.'</p>';
$message .= '<p>Email: '.$email.'</p>';
$message .='<p>Thanks <br>
'.WEBSITE_SIGNATURE.'
</p>';
$this->email->message($message);
$this->email->send();
/* Send User Email */
$User_EmailId = $email;
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from(FROM_EMAIL, FROM_NAME);
$this->email->to($User_EmailId);
//$this->email->cc(CC_EMAIL_ID);
//$this->email->bcc('them@their-example.com');
$this->email->subject('Account is created |'.WEBSITE_EMAIL_TITLE);
$message = '<h2>'.WEBSITE_EMAIL_TITLE.'</h2>';
$message .= '<p>Hi '.$first_name.' you have successfully created your account, </p>';
$message .= '<p> Login URL: <a href="'.BASE_URL.'login">Click here</a> </p>';
$message .= '<p> Username: '.$email.' </p>';
$message .= '<p> Password: '.$first_name.' </p>';
$message .='<p>Thanks <br>
'.WEBSITE_SIGNATURE.'
</p>';
$this->email->message($message);
$this->email->send();
$this->session->set_userdata('bh_front_user_id', $User_id);
$this->session->set_userdata('bh_front_email_id', $email_id);
$this->session->set_userdata('bh_front_username', $first_name);
$this->session->set_userdata('bh_google_src', $picture);
return 'myaccount';
}
}
public function getALLUser(){
$this->db->select("*");
$this->db->from('bh_users');
$this->db->order_by("user_id","desc");
$query=$this->db->get();
return $query->result_array();
}
public function getALLUserActive(){
$this->db->select("*");
$this->db->from('bh_users');
$this->db->where("status","1");
$this->db->order_by("user_id","desc");
$query=$this->db->get();
return $query->result_array();
}
public function getALLUserByType($usertype){
$this->db->select("*");
$this->db->from('bh_users');
$this->db->where("user_type",$usertype);
$this->db->order_by("user_id","desc");
$query=$this->db->get();
return $query->result_array();
}
public function getALLAddressByType($user_id){
$this->db->select("*");
$this->db->from('bh_address');
$this->db->where("user_id",$user_id);
$this->db->order_by("address_id","desc");
$query=$this->db->get();
return $query->result_array();
}
public function AddressByID($user_id){
$this->db->select("*");
$this->db->from('bh_address');
$this->db->where("user_id",$user_id);
$this->db->order_by("user_id","desc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData;
}
public function UserByID($user_id){
$this->db->select("*");
$this->db->from('bh_users');
$this->db->where("user_id",$user_id);
$this->db->order_by("user_id","desc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData;
}
public function GetMySupportRandomListing(){
$this->db->select("*");
$this->db->from('bh_support_listings');
$this->db->where('status',"1");
$this->db->limit(3,0);
$this->db->order_by('rand()');
$query=$this->db->get();
return $query->result_array();
}
public function GetMyNeedRandomListing(){
$this->db->select("*");
$this->db->from('bh_need_listings');
$this->db->where('status',"1");
$this->db->limit(3,0);
$this->db->order_by('rand()');
$query=$this->db->get();
return $query->result_array();
}
public function setHomePage($type,$blog_id=""){
if($type=="unset"){
$data2= array("set_home"=>'0');
$this->db->update("bh_users",$data2);
}else if($type=="set"){
$updata= array("set_home"=>'1');
$this->db->where("user_id",$blog_id);
$this->db->update("bh_users",$updata);
}
}
public function setBloghome(){
$this->db->select("*");
$this->db->from('bh_users');
$this->db->where("status",'1');
$this->db->where("set_home",'1');
$this->db->order_by("id","desc");
$query=$this->db->get();
$userData = $query->result_array();
return $userData;
}
}