Beispiel #1
0
 function edit_number_post()
 {
     $key_empty = '';
     if (empty($this->post('userid'))) {
         $key_empty = 'userid';
     }
     if (empty($this->post('mobile'))) {
         $key_empty = 'mobile';
     }
     if (!empty($key_empty)) {
         // Set the response and exit
         $this->response(['status' => FALSE, 'message' => $key_empty . ' not found', 'code' => REST_Controller::HTTP_BAD_REQUEST], REST_Controller::HTTP_OK);
         // NOT_FOUND (404) being the HTTP response code
     }
     //echo $user_type = get_user_type($this->post('userid'));exit;
     $user_prefix_and_table = get_user_prefix_and_table($this->post('userid'));
     //print_r($user_prefix_and_table);exit;
     $user_detail_prefix = $user_prefix_and_table['user_detail_prefix'];
     $user_detail_table = $user_prefix_and_table['user_detail_table'];
     $new_number = array($user_detail_prefix . '_contact_number' => $this->post('mobile'));
     if ($this->user->is_mobile_exist($this->post('mobile'), $this->post('userid'))) {
         $this->response(['status' => FALSE, 'message' => 'Mobile number already exists.', 'code' => REST_Controller::HTTP_BAD_REQUEST], REST_Controller::HTTP_OK);
         // NOT_FOUND (404) being the HTTP response code
     }
     $this->user->update_user_contact_number($this->post('userid'), $user_detail_table, $new_number);
     //$otp = otp_generate();
     $new_otp = array('otp' => 12345, 'otp_expire_time' => otp_expire());
     //$success = numeric and string;
     $success = $this->user->new_otp($this->post('userid'), $new_otp);
     if ($success == 1) {
         $this->response(['status' => TRUE, 'userid' => $this->post('userid'), 'code' => REST_Controller::HTTP_OK], REST_Controller::HTTP_OK);
         // CREATED (201) being the HTTP response code
     } else {
         $this->response(['status' => False, 'message' => $success, 'code' => REST_Controller::HTTP_INTERNAL_SERVER_ERROR], REST_Controller::HTTP_OK);
     }
 }
Beispiel #2
0
 function user_name($email_id = NULL)
 {
     $user_id = $this->pdb->singleVal("bom_users", "login_email='{$email_id}'", "user_id");
     $user_prefix_and_table = get_user_prefix_and_table($user_id);
     $user_detail_prefix = $user_prefix_and_table['user_detail_prefix'];
     $user_detail_table = $user_prefix_and_table['user_detail_table'];
     $display_name = $user_detail_prefix . "_display_name";
     return $this->pdb->singleVal($user_detail_table, "user_id='{$user_id}'", $display_name);
 }