file_get_contents
1#@!#!123s
D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
u247928417
/
domains
/
fruitbagan.com
/
public_html
/
androidapplication
/
Filename :
mobile-user-registration.php
back
Copy
<?php include("config/database.php"); if($_REQUEST['mobile']!=''){ $mobile=mysqli_real_escape_string($conn,trim($_REQUEST['mobile'])); $sel_existdata="SELECT * FROM `customer_user` WHERE `customer_mobile`='".$mobile."'"; $query_existdata=mysqli_query($conn, $sel_existdata) or mysqli_error($conn); $numexistdata=mysqli_num_rows($query_existdata); $dataVal=mysqli_fetch_assoc($query_existdata); if($numexistdata>0){ /*************************sms Details start here*************************/ //Generating a 4 Digits OTP or verification code $fourRandomOTP = mt_rand(1000,9999); // Message details $numbers = $_REQUEST['mobile']; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://sms.staticking.com/index.php/smsapi/httpapi/", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "secret=3tw5Ha5NVyav1gvMj2i1&sender=FSWANK&tempid=1307165183049041907&receiver=".$numbers."&route=TA&msgtype=1&sms=".$fourRandomOTP." is your OTP to register/login to your fruitbagan mobile app account. It will be valid for 10 minutes. FSWANK", CURLOPT_HTTPHEADER => array("Cache-Control: no-cache","Content-Type: application/x-www-form-urlencoded"),)); // Process your response here $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); $sel="select customer_id from customer_user where customer_mobile='".$numbers."'"; $query=mysqli_query($conn, $sel) or mysqli_error($conn); $fetchUserid=mysqli_fetch_assoc($query); //insert data into otp table $insertOtp="insert into interface_user_otp(otp_number,otp_customer_id,otp_flag,otp_date)values('".$fourRandomOTP."','".$fetchUserid['customer_id']."','0','".date('Y-m-d')."')"; $QueryOtp = mysqli_query($conn,$insertOtp) or mysqli_error($conn); /*************************sms Details end here***************************/ echo '{ "user_id": "'.$dataVal['customer_id'].'", "customer_first_name": "'.$dataVal['customer_first_name'].'" , "customer_last_name": "'.$dataVal['customer_last_name'].'" , "IsExist": "true", "message":"true" }'; }else{ $sel_existdata = "INSERT INTO `customer_user`(`customer_mobile`,`is_active`,`customer_created`,`user_type`,`fcmid`) VALUES ('".$mobile."','0','".date('Y-m-d H:i:s')."','App','".$_REQUEST['fcmid']."')"; $query_existdata=mysqli_query($conn, $sel_existdata) or mysqli_error($conn); /*************************sms Details start here*************************/ //Generating a 4 Digits OTP or verification code $fourRandomOTP = mt_rand(1000,9999); // Message details $numbers = $_REQUEST['mobile']; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "http://sms.staticking.com/index.php/smsapi/httpapi/", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "secret=3tw5Ha5NVyav1gvMj2i1&sender=FSWANK&tempid=1307165183049041907&receiver=".$numbers."&route=TA&msgtype=1&sms=".$fourRandomOTP." is your OTP to register/login to your fruitbagan mobile app account. It will be valid for 10 minutes. FSWANK", CURLOPT_HTTPHEADER => array("Cache-Control: no-cache","Content-Type: application/x-www-form-urlencoded"),)); // Process your response here $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); $sel="select customer_id from customer_user where customer_mobile='".$numbers."'"; $query=mysqli_query($conn, $sel) or mysqli_error($conn); $fetchUserid=mysqli_fetch_assoc($query); //insert data into otp table $insertOtp="insert into interface_user_otp(otp_number,otp_customer_id,otp_flag,otp_date)values('".$fourRandomOTP."','".$fetchUserid['customer_id']."','0','".date('Y-m-d')."')"; $QueryOtp = mysqli_query($conn,$insertOtp) or mysqli_error($conn); /*************************sms Details end here***************************/ echo '{ "user_id": "'.$fetchUserid['customer_id'].'", "IsExist": "false", "message":"true" }'; } }else{ echo '{"message":"false"}'; } ?>