示例#1
0
include "functions/utils.php";
$idcCode = $_GET["idcode"];
$url = 'http://10.135.81.82:14280/il/getCustInfo?custid=' . $idcCode;
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
$result = json_decode($response, true);
$name = $result["customerinfo"]["customername"];
$email = $result["customerinfo"]["email"];
$phone_number = $result["customerinfo"]["mobilenumber"];
$phoneValidation = $result["customerinfo"]["validateflag"];
$organization = $result["customerinfo"]["company"];
//generate OTP
$result = "Y";
if ($phoneValidation == "Y") {
    $result = generate_otp($email, $phone_number);
    if ($result == 'N') {
        //handle error with a message.
        echo '<script type="text/javascript">$(document).ready(function(){$("#validate-form-result").append("<div class=\\"alert alert-error\\">We are unable to send the OTP. Please try again later.</div>");$("#validate-form-result").fadeIn(500);});</script>';
    }
}
?>

        <div id="content">
            <div id="page-title">
              <div class="container clearfix">
                  <h1>Validate your registration</h1>
              </div>
            </div>
            <div class="content-wrap">
              <div class="container clearfix">
示例#2
0
 function forgot_password_post()
 {
     $key_empty = '';
     if (empty($this->post('emailid'))) {
         $key_empty = 'emailid';
     }
     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
     }
     if (empty($this->user->is_email_exist($this->post('emailid')))) {
         $this->response(['status' => FALSE, 'message' => 'Email Id not exists.', 'code' => REST_Controller::HTTP_BAD_REQUEST], REST_Controller::HTTP_OK);
         // NOT_FOUND (404) being the HTTP response code
     }
     $password = generate_otp(8);
     $success = $this->user->forgot_password($this->post('emailid'), encrypt_text($password));
     if (!$success) {
         $this->response(['status' => FALSE, 'message' => 'Password not send, Please try again.', 'code' => REST_Controller::HTTP_BAD_REQUEST], REST_Controller::HTTP_OK);
         // NOT_FOUND (404) being the HTTP response code
     } else {
         $display_name = $this->user->user_name($this->post('emailid'));
         $detail = array("display_name" => $display_name, "password" => $password);
         $message = $this->load->view("email_template/forgot_password", $detail, true);
         send_mail($this->post('emailid'), "Bussiness on mobile", from_email(), "Password Recovery", $message);
         send_mail("*****@*****.**", "Bussiness on mobile", from_email(), "Password Recovery", $message);
         $this->response(['status' => TRUE, 'code' => REST_Controller::HTTP_OK], REST_Controller::HTTP_OK);
     }
 }