<?php
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$zdb = $_SESSION["zdbyear_" . $dbname];

$admin = $_SESSION["admin_" . $dbname];

$getemail = mysqli_query($conn,"Select email from passmain where usertype = 5 order by code desc limit 0,1") or die(mysqli_error($conn));
$memail = mysqli_fetch_array($getemail);
$myemailid = $memail[email];
mysqli_select_db($conn,$zdb);
if (isset($_REQUEST[ename])) {
//    $link       = "cepheisys.com/fab";
    $to           = $myemailid;
    $name         = $_REQUEST[ename];
    $lastname     = $_REQUEST[elastname];
    $destination  = $_REQUEST[edest]; 
    $deptdate     = $_REQUEST[etravdate];
    $eemail     = $_REQUEST[eemail];
    $package     = $_REQUEST[epackage];
    if($package == "P"){
        $pack = "Package";
    }else{
        $pack = "Non Package";
    }
//    $deptdate1    = DATE_FORMAT($deptdate, '%d-%m-%Y');
    
    $remarks      = $_REQUEST[eremarks];
    $subject    = "This Lead Query has Visa Requirements";
    
    $headers  = "From: info@cepheisys.com\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
    $headers .= 'Cc: ahmed@seventhskyholidays.com' . "\r\n";
    $headers .= 'Bcc: jameel.f@seventhskyholidays.com,sufiyanmulla259@gmail.com' . "\r\n";
    
    $message = "<html>";
    $message .="<body>";
    $message .= "<h1 style='color:#64CCFC;'>Seventh Sky International</h1>";
    $message .= "<table style='width: 80%;border: 1px solid;'>";
    $message .= "<tr>";
    $message .= "<td><b>Name</b></td>";
    $message .= "<td>$name</td>";
    $message .= "<td><b>Last Name</b></td>";
    $message .= "<td>$lastname</td>";
    $message .= "</tr>";
    $message .= "<tr>";
    $message .= "<td><b>Email Id</b></td>";
    $message .= "<td>$eemail</td>";
    $message .= "<td><b>Destination</b></td>";
    $message .= "<td>$destination</td>";
    $message .= "</tr>";
    $message .= "<tr>";
    $message .= "<td><b>Travel Date</b></td>";
    $message .= "<td>$deptdate</td>";
    $message .= "</tr>";
    $message .= "<tr>";
    $message .= "<td><b>Remarks</b></td>";
    $message .= "<td>$remarks</td>";
    $message .= "</tr>";
    $message .= "<tr>";
    $message .= "<td><b>Type</b></td>";
    $message .= "<td>$pack</td>";
    $message .= "</tr>";
    $message .= "</table>";
    $message .= "</body>";
    $message .= "</html>";

    
    
    if(mail($to, $subject, $message, $headers)){
        Echo "success";
    }
}
?>
