File: /home/barbeatleanalyti/public_html/m.beatleanalytics.com/application/models/Andriod_model.php
<?php
class Andriod_model extends CI_Model
{
public function loginIndustry($Indid)
{
$this->load->database();
$query = $this->db->get_where("beatle_industry", array("db_IndLoginId"=>$Indid));
$result = $query->result();
if (!empty($result))
{
//$loginIndId = $result[0]->db_IndLoginId;
$json = json_encode($result);
return $json;
}
else
{
$error = '[{"error":"1" , "fail":"2"}]';
return $error;
}
}
public function enduserlogin($username,$userpassword)
{
$this->load->database();
$password = md5($userpassword);
$usertype = "End_user";
$this->db->select("*");
$this->db->from("beatle_userlogin");
$this->db->where("db_userLoginName",$username);
$this->db->or_where("db_email",$username);
$this->db->or_where("db_phone",$username);
$this->db->where("db_usertype",$usertype);
$this->db->where("db_password",$password);
$query = $this->db->get();
$result = $query->result();
if (!empty($result))
{
$json = json_encode($result);
return $json;
}
else
{
$error = '[{ "error":"username or password does not match" ,"fail":"2" }]';
return $error;
}
}
public function signupuser($usermobile,$useremail,$pass)
{
$this->load->database();
$userpass = md5($pass);
$this->db->select("*");
$this->db->from("beatle_userlogin");
$this->db->where("db_email",$useremail);
$this->db->or_where("db_phone",$userpass);
$query = $this->db->get();
$result = $query->result();
if (!empty($result))
{
$error = '[{"error":"Email or Mobile Number Already In Database" , "fail" : "2"}]';
return $error;
}
else
{
$status = "1";
$date = date("Y-m-d H:i:s");
$type = "End_user";
$uniq = rand(1,1000);
$unqId = 'END_'.$uniq;
$insertdata = array
(
"db_email" => $useremail,
"db_phone" => $usermobile,
"db_password" => $userpass,
"db_usertype" => $type,
"db_userRandId" => $unqId,
"created_date" => $date,
"db_status" => $status
);
//print_r($insertdata);die;
$query = $this->db->insert("beatle_userlogin" , $insertdata);
if ($query)
{
$success = '[{ "success":"1"}]';
return $success;
}
else
{
$error = '[{ "error" : "Please Check Internet Connection" }]';
return $error;
}
}
}
public function IndustryPages($IndId)
{
$this->load->database();
$query = $this->db->get_where("beatle_industry",array("db_IndLoginId"=>$IndId));
$result = $query->result();
return $result;
}
public function getallpages($pageid)
{
$this->load->database();
$pageD = explode(',',$pageid);
foreach ($pageD as $k=>$v)
{
$this->db->select("*");
$this->db->from("beatle_page");
$this->db->join("beatle_pageContent " , "beatle_page.pageId = beatle_pageContent.db_pageid");
$this->db->where("beatle_page.pageId",$v);
$query = $this->db->get();
$result = $query->result();
if (!empty($result))
{
$data['pagename'][] = $result;
}
}
return $data;
}
}
?>