Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.129.63.214
<?php
include("/var/www/config.php");
include ('/var/www/html/sms/sendsmsapiv1.php');
include("/var/www/html/univadmin/src/sendGridMail.php");
// $servername = "logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com";
$servername = SERVERNAME;
$username = USERNAME;
$password = PASSWORD;
$database = "logisys3_demo";
//$servername = "bkmariappacharities.org";
// $servername = "184.168.117.223";
// $username = "bkmh_alumni";
// $password = "Arunkumar@22";
// $database = "bkhm_alumni";
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$conn = new mysqli($servername,$username,$password,$database);
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$FMEMNAME = $_POST["FMEMNAME"];
$FMOBILE = $_POST["FMOBILE"];
$FBATCH = $_POST["FBATCH"];
$FCNTCODE = json_decode($_POST["FCNTCODE"],true);
$FEMAIL = $_POST["FEMAIL"];
$date = date('Y-m-d H:i:s');
$fcont = explode(" ",$FCNTCODE);
if($fcont[0] !== ""){
$fcode = $fcont[0];
}else if($fcont[0] == ""){
$fcode = $fcont[1];
}
$fccode = "+{$fcode}";
$query = "select ifnull(FSTATUS,'') as FSTATUS,FMOBILE from memhead
where FMOBILE='{$FMOBILE}'";
// and ifnull(fstatus,'') <> 'T'";
$result1 = mysqli_query($conn,$query);
$row = mysqli_fetch_assoc($result1);
$count = mysqli_num_rows($result1);
$mob = $row['FMOBILE'];
$fstatus = $row['FSTATUS'];
if($count == 1){
if($fstatus !== ""){
if($mob == $FMOBILE){
$row['mob'] = $FMOBILE;
$row['status'] = 'invalid';
$row['msg'] = 'This Mobile number is already registered';
echo json_encode($row);
return;
}
}
}
// if($email == $FEMAIL){
// $row['email'] = $email;
// $row['status'] = 'invalid';
// $row['msg'] = 'This Email id is already registered';
// echo json_encode($row);
// return;
// }
$cont = '+'.$FCNTCODE;
if($count == 0){
$query = "INSERT INTO memhead (FMEMNAME, FMOBILE,FPASWD,FEMAIL,FLOGDATE,FCNTCODE,FBATCH,FTYPE)
VALUES ('{$FMEMNAME}','{$FMOBILE}','{$FMOBILE}','{$FEMAIL}','{$date}','{$fccode}','{$FBATCH}','M')";
$result = mysqli_query($conn,$query);
}
$query = "select * from memhead where FMOBILE='{$FMOBILE}'";
$result1 = mysqli_query($conn,$query);
$row = mysqli_fetch_assoc($result1);
$count = mysqli_num_rows($result1);
if($fccode === "+91"){
if($count == 1){
// $emailsent = $FEMAIL;
$univcode = "098";
// $onldate = date('d-m-Y');
// $emlotp = rand(100000, 90000);
// $message = "<html>";
// $message .= "<body>";
// $message .= "<style>";
// $message .= ".mail_tbl td{text-align:left; padding:2px; font-size:12px;
// font-family: Verdana, Arial, Helvetica, sans-serif;}";
// $message .= "</style>";
// // $message .= "<center><img src='{}' height='100px' width='200px'/></center>";
// $message .= "<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif; text-align:center; >
// B.K. Mariappa's Charities</p>";
// $message .= "<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif; text-align:right'>Date :" . " $onldate " . "</p>";
// $message .= "<p>Dear Sir/Madam,<br></p>";
// $message .= "<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
// Your verification OTP {$emlotp}</p>";
// $message .="<br/>";
// $message .= "<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
// Thanking You,</p>";
// $message .= "</body>";
// $message .= "</html>";
// $subject = strtoupper("Subject :Email Verification OTP");
// $from = "";
// $resp = sendGridMail($emailsent, $subject, $message, $univcode);
date_default_timezone_set('Asia/Kolkata');
$time = date("h:i A");
$otp = rand(100000, 90000);
$sms = "Dear User, OTP for Software Registration is $otp - PMSOLU";
$api = "https://api.onex-aura.com/api/sms?";
$url = $api;
$url.= "key=hyCR3Tm7";
$url.= "&from=PMSOLU";
$text = urlencode($sms);
$url.= "&body={$text}";
$url.= "&entityid=1701160750260327092";
$url.= "&to={$FMOBILE}";
$url.= "&templateid=1707171885912346766";
$session = curl_init($url);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
curl_close($session);
// $smsotp = "Dear User, OTP for Software Registration is $otp - PMSOLU";
// $sms = new SMS('098', 'OTP');
// $sms->sendIndvidualSms($FMOBILE, $smsotp, '900', 'PGET');
$smsresp = 'Sent';
$row["sms"] = $smsresp;
$query = "update memhead set FMOBOTP = '{$otp}' where FMOBILE='{$FMOBILE}'";
$result = mysqli_query($conn, $query);
if($result){
$row1["status"] = 'success';
$row1["msg"] = 'OTP Sent To Your Mobile No. Please Verify';
echo json_encode($row1);
}else{
$row1["status"] = 'invalid';
$row1["msg"] = 'Registered Failed';
echo json_encode($row1);
}
}else{
$row2['status'] = 'invalid';
$row2['msg'] = 'Registered Failed';
echo json_encode($row2);
}
}
// else{
// $row1["status"] = 'success';
// $row1["msg"] = 'Successfull update';
// echo json_encode($row1);
// $emailsent = $FEMAIL;
// $univcode = "098";
// $onldate = date('d-m-Y');
// $emlotp = rand(100000, 90000);
// $message = "<html>";
// $message .= "<body>";
// $message .= "<style>";
// $message .= ".mail_tbl td{text-align:left; padding:2px; font-size:12px;
// font-family: Verdana, Arial, Helvetica, sans-serif;}";
// $message .= "</style>";
// // $message .= "<center><img src='{}' height='100px' width='200px'/></center>";
// $message .= "<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif; text-align:center; >
// B.K. Mariappa's Charities</p>";
// $message .= "<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif; text-align:right'>Date :" . " $onldate " . "</p>";
// $message .= "<p>Dear Sir/Madam,<br><br><br></p>";
// $message .= "<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
// Your verification OTP {$emlotp}</p>";
// $message .="<br/>";
// $message .= "<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>
// Thanking You,</p>";
// $message .= "</body>";
// $message .= "</html>";
// $subject = strtoupper("Subject :Email Verification OTP");
// $from = "";
// $resp = sendGridMail($emailsent, $subject, $message, $univcode);
// $query = "update memhead set FEMAILOTP = '{$emlotp}' where FMOBILE='{$FMOBILE}'";
// $result = mysqli_query($conn, $query);
// if($result){
// $row1["status"] = 'success';
// $row1["msg"] = 'OTP Sent To Your Email Please Verify';
// echo json_encode($row1);
// }else{
// $row1["status"] = 'invalid';
// $row1["msg"] = 'Registered Failed';
// echo json_encode($row1);
// }
// }
mysqli_close($conn);
?>
|