Commit 637f6a6b by Tobin

daily commit

parent f88ec774
...@@ -237,6 +237,73 @@ class Webservices extends CI_Controller { ...@@ -237,6 +237,73 @@ class Webservices extends CI_Controller {
} }
echo json_encode($respArr); exit; echo json_encode($respArr); exit;
} }
// edit_customer_profile
public function edit_customer_profile(){
header('Content-type: application/json');
$post = file_get_contents("php://input");
$postData = json_decode($post, true);
$this->load->model('Customer_model');
$respArr = array('status'=>'0','message'=>'Something went wrong.');
if(empty($postData)){
echo json_encode($respArr);exit;
}
$err = 0;
$msg = '';
if(!isset($postData['email']) || empty($postData['email'])){
$err = 1;
$msg = 'Provide a valid Email ID';
}
else if(!isset($postData['first_name']) || empty($postData['first_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['last_name']) || empty($postData['last_name'])){
$err = 1;
$msg = 'Provide valid Name';
}
else if(!isset($postData['phone']) || empty($postData['phone'])){
$err = 1;
$msg = 'Provide valid Phone';
}
else if(!isset($postData['address']) || empty($postData['address'])){
$err = 1;
$msg = 'Provide valid Address';
}
if($err == 1){
$respArr['message'] = $msg;
echo json_encode($respArr);exit;
}
pr($postData);
unset($postData['cpassword']);
if(isset($postData['password']) && !empty($postData['password'])){
$postData['password'] = md5($postData['password']);
}
$custResp = $this->Customer_model->custProfileEdit($postData);
if(empty($custResp) || !isset($custResp['status']) || empty($custResp['status'])){
echo json_encode($respArr);exit;
}
if($custResp['status'] == '1'){
$respArr['status'] = '1';
$respArr['message'] = 'Profile successfully updated';
echo json_encode($respArr);exit;
} else if($custResp['status'] == '2'){
$respArr['status'] = '2';
$respArr['message'] = 'Email Address already in use';
echo json_encode($respArr);exit;
} else if($custResp['status'] == '3'){
$respArr['status'] = '3';
$respArr['message'] = 'Phone Number already in use';
echo json_encode($respArr);exit;
}
echo json_encode($respArr); exit;
}
} }
?> ?>
\ No newline at end of file
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