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 : 18.188.245.152


Current Path : /var/www/website/bkmh/php/
Upload File :
Current File : /var/www/website/bkmh/php/saveFinbkmh.php

<?php
include("config.php");  
include ('../../../sms/sendsmsapiv1.php');  

$servername = "logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com";
$username   = "admin";
$password  = "T0g3th3r@all";
$database = "logisys3_demo";

//$servername = "bkmariappacharities.org";
// $servername = "184.168.117.223";
// $username   = "bkmh_alumni";
// $password  = "Arunkumar@22";
// $database = "bkhm_alumni";
    
$conn = new  mysqli($servername,$username,$password,$database);

if(!$conn) 
{
    die("Connection failed: " . mysqli_connect_error());
}
error_reporting(E_ALL);
ini_set('display_errors', 'on');

$FMEMNAME = $_POST["FMEMNAME"];
$FBATCH = $_POST["FBATCH"];
$FMOBILE = $_POST["FMOBILE"];
$FDEGREE = $_POST["FDEGREE"];
$FEMAIL = $_POST["FEMAIL"];
$FALTMOBILE = $_POST["FALTMOBILE"];
$FALTCNTCODE =$_POST["FALTCNTCODE"];
$FYOA = $_POST["FYOA"];
$FYOM = $_POST["FYOM"];
$comadres1 = $_POST["comadres1"];
$comadres2 = $_POST["comadres2"];
$pincodecom = $_POST["pincodecom"];
$statec = $_POST["statec"];
$ccountry = $_POST["ccountry"];
$peradres1 = $_POST["peradres1"];
$peradres2 = $_POST["peradres2"];
$pincodeper = $_POST["pincodeper"];
$statep = $_POST["statep"];
$pcountry = $_POST["pcountry"];
$FJOBDESC = $_POST["FJOBDESC"];
$data = json_decode($_POST["data"],true);
$date = date('Y-m-d H:i:s');
$split_fmob= explode("-",$FMOBILE);
$fcont = explode(" ",$FALTCNTCODE);
$faltmob = "";
if($FALTCNTCODE !== ""){
    if($fcont[0] !== ""){
        $fcode = $fcont[0];
    }else if($fcont[0] == ""){
        $fcode = $fcont[1];
    }
    $faltmob = "+".$fcode; 
}
$fmob = $split_fmob[1];

$query = "update memhead set FBATCH='{$FBATCH}', FDEGREE = '{$FDEGREE}', FALTCNTCODE = '{$faltmob}',
        FEMAIL = '{$FEMAIL}',FALTMOBILE = '{$FALTMOBILE}',FYOA = '{$FYOA}',FYOM ='{$FYOM}',FADDC1 ='{$comadres1}',
        FADDC2 = '{$comadres2}',FPINCODEC = '{$pincodecom}',FSTATEC = '{$statec}',FCONTC = '{$ccountry}',
        FADDP1 ='{$peradres1}',FADDP2 ='{$peradres2}',FSTATEP ='{$statep}',FCONTP ='{$pcountry}',
        FPINCODEP ='{$pincodeper}', FJOBDESC = '{$FJOBDESC}', FUPD = 'T'
        where FMOBILE = '{$fmob}'";

$result = mysqli_query($conn,$query);

foreach($data as $val){
    $memcode = "select FMEMCODE from memhead where FMOBILE = '{$fmob}'";
    $res = mysqli_query($conn,$memcode);
    $row = mysqli_fetch_assoc($res);
    $mem_code = $row['FMEMCODE'];

    $quer = "INSERT INTO memref (FMEMCODE,FMEMNAME, FMOBILE,FEMAIL,FLOGDATE)
    VALUES ('{$mem_code}','{$val['name']}','{$val['mobile']}','{$val['email']}','{$date}')";
    $result1 = mysqli_query($conn,$quer);
}

if($result){
	$row["error_code"] = "success";
    $row["msg"] = "Successfully Updated";
    echo json_encode($row);
}else{
	$row['error_code'] = 'invalid';
    $row["msg"] = "Failed Updated";
	echo json_encode($row);
}


mysqli_close($conn);
?>