MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/cafsindia/allyindian_com/sbltt/app/get_enquiry_api.php
<?php
if($_SERVER['HTTP_ORIGIN'] == "http://sblttweb.cafsinfotech.com") {
    header('Access-Control-Allow-Origin: http://sblttweb.cafsinfotech.com');  
}

if($_SERVER['HTTP_ORIGIN'] == "http://sblt.co.in") {
    header('Access-Control-Allow-Origin: http://sblt.co.in');  
}
	include('./dbconnect.php');
	$dbconnect = new dbconnect;
	$db = $dbconnect->connect();
	$frm = "";	
    if(isset($_GET["frm"])){
		$frm = $_GET['frm'];
	}
	if(isset($_GET["veh_type"])){
		$veh_type = $_GET['veh_type'];
	}		
	
	if($frm === "get_enquiry"){	
		//Customer Info
			$phone_number          = $_POST['mobile'];
			$cust_name             = $_POST['custname'];
			$address               = $_POST['address'];
			$city                  = $_POST['city'];
			$state                 = $_POST['state'];
			$country               = $_POST['country'];
			$pincode               = $_POST['pincode'];
			$source                = $_POST['source'];
			$destination           = $_POST['destination'];
			// $email                 = $_POST['email'];
   			$alt_number			   = $_POST['telephone'];             
		//Enquiry Info
			$from_date             = date("Y-m-d",strtotime($_POST['datefrom']));
			$to_date               = date("Y-m-d",strtotime($_POST['dateto']));
			$trip_days             = $_POST['nodays'];
			$enquire_for           = $_POST['enqfordetail']; //trip_details
			$remark                = $veh_type;
			$created_date          = date("Y-m-d H:i:s");
		
		if($phone_number){
			$qry_info   = mysql_query("SELECT cust_id FROM sblt_customers where phone_number = '$phone_number' and deleted = 0");
			$rslt_count = mysql_num_rows($qry_info);
		}
		
		if($rslt_count === 0){			
			mysql_query("INSERT INTO sblt_customers(customer_name,phone_number,alt_number,cust_address,city,state,referral_type,cust_sts, created_date) VALUES ('$cust_name','$phone_number','$alt_number','$address','$city','$state','Web_Portal','Active','$created_date')");
			//$id = mysql_query("SELECT LAST_INSERT_ID()");
			$qry_info   = mysql_query("SELECT cust_id from sblt_customers where phone_number = '$phone_number' and deleted = 0");
			$rslt_customer = mysql_fetch_array($qry_info);
			$cust_id       = $rslt_customer['cust_id'];
			if($cust_id){
				$enq_insert = mysql_query("INSERT INTO sblt_enquiry(cust_id,orgin,destination,from_date,to_date,trip_days,enquiry_sts,remark,ncd,created_date) VALUES ('$cust_id','$source','$destination','$from_date','$to_date','$trip_days','1','$remark','$created_date','$created_date')");
				$id = mysql_insert_id();
			}
			if($id){
				$enq_log_qry = mysql_query("INSERT INTO sblt_enquiry_log(enquiry_id,trip_days,enquiry_sts,remark,ncd,created_date) VALUES ('$id','$trip_days','1','$remark','$created_date','$created_date')");
			}
				if($enq_log_qry){	
					echo json_encode(array('success' => TRUE, "msg" =>'Successfully submitted Your Enquiry!'));
				}else{
					echo json_encode(array('success' => FALSE, "msg" =>'Please Try After Sometime!'));
				}
		}else{
			$rslt_customer = mysql_fetch_array($qry_info);
			$cust_id       = $rslt_customer['cust_id'];
			if($cust_id){				
				$enq_insert = mysql_query("INSERT INTO sblt_enquiry(cust_id,orgin,destination,from_date,to_date,trip_days,enquiry_sts,remark,ncd,created_date) VALUES ('$cust_id','$source','$destination','$from_date','$to_date','$trip_days','1','$remark','$created_date','$created_date')");
				$id = mysql_insert_id();
			}			
			if($id){
				$enq_log_qry = mysql_query("INSERT INTO sblt_enquiry_log(enquiry_id,trip_days,enquiry_sts,remark,ncd,created_date) VALUES ('$id','$trip_days','1','$remark','$created_date','$created_date')");
			}
			
			if($enq_log_qry){
				echo json_encode(array('success' => TRUE, "msg" =>'Successfully submitted Your Enquiry!'));
			}else{
				echo json_encode(array('success' => FALSE, "msg" =>'Please Try After Sometime!'));
			}
		}
	}else{
		echo json_encode(array('success' => FALSE, "msg" =>'Server Timeout'));
	}
?>