<?php
require_once('dbConnect.php');
//This function will send the otp
function sendOtp($numberv, $pass){
//This is the sms text that will be sent via sms
$sms_content = "Welcome to : Your password is $pass";
//Encoding the text in url format
$sms_text = urlencode($sms_content);
//This is the Actual API URL concatnated with required values
$api_url = 'xx'
//Envoking the API url and getting the response
$response = file_get_contents($api_url);
//Returning the response
return $response;
}
//If a post request comes to this script
if($_SERVER['REQUEST_METHOD']=='POST'){
//getting username password and phone number.
$numberv = $_POST['numberv'];
//Generating a 6 Digits OTP or verification code
$query = mysqli_query($con,"SELECT password FROM users WHERE mobile = '".$numberv."'");
if($query && $var = mysqli_fetch_array($query)) {
$v = $var['password'];
$pass = echo $v;
}
//Importing the db connection script
$result = mysqli_query($con,"SELECT * FROM otpverify WHERE phone = '".$numberv."' AND verified = '1'");
if(mysqli_num_rows($result)>=1){
$sql = "INSERT INTO forgotpass (numberv, pass) values ('$numberv','$pass')";
}
//If the query executed on the db successfully
if(mysqli_query($con,$sql)){
//printing the response given by sendOtp function by passing the otp and phone number
}else{
//printing the failure message in json
echo 'Failure';
}
//Closing the database connection
mysqli_close($con);
}
Here i need paste the value in that password string.
Thanks in Advance