Commit acbad240 by Tobin

registration

parent 35b13554
......@@ -4,17 +4,18 @@ if (isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400');
}
}
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])){
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
}
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])){
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
exit(0);
}
exit(0);
}
class Api extends CI_Controller {
......@@ -44,7 +45,6 @@ class Api extends CI_Controller {
public function index() {
$res = $this->Validation_model->validation_check('login',array('email_id'=>'adarsh'));
}
public function response($data) {
......@@ -516,8 +516,7 @@ class Api extends CI_Controller {
$res = $this->Api_model->checker_login($data);
if($res['status']!=0){
$this->response($res['data']);
}
else{
} else {
$this->errorResponse($res['code'],$res['message']);
}
}
......
......@@ -36,7 +36,7 @@ class Api_model extends CI_Model {
try{
$email = $data['email_id'];
$phone = $data['phone'];
$res_count = $this->db->query("SELECT * FROM customer INNER JOIN `users` ON users.id = customer.customer_id AND users.user_type = 3 WHERE users.status = 1 AND (customer.email = '$email' OR customer.phone = '$phone')")->row();
$res_count = $this->db->query("SELECT * FROM customer INNER JOIN `users` ON users.id = customer.customer_id AND users.user_type = 3 WHERE users.status = 1 AND (customer.email = '$email' OR customer.phone LIKE '%$phone')")->row();
//$res_count = $this->db->where('email',$data['email_id'])->where()->or_where('phone',$data['phone'])->get('customer')->row();
if(count($res_count) > 0) {
if($res_count->email == $data['email_id'] && $res_count->phone == $data['phone']){
......@@ -58,6 +58,13 @@ class Api_model extends CI_Model {
$this->db->insert('users',$user_data);
$id = $this->db->insert_id();
if($id) {
if(strpos($data['phone'],'+') === true){
$data['phone'] = str_replace('+','',$data['phone']);
}
if(strpos($data['phone'],'966') !== true){
$data['phone'] = '966'.$data['phone'];
}
$customer_data = array(
'customer_id'=>$id,
'phone'=>$data['phone'],
......@@ -519,7 +526,6 @@ class Api_model extends CI_Model {
}
function recommend($data) {
try {
$per_page = 10;
$user_id = $this->auth_token_get($data['auth_token']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment