<?php
include("DBConfig.php");
$patientname = mysqli_real_escape_string($con, $_POST['name']);
$email = mysqli_real_escape_string($con, $_POST['email']);
$mobile = mysqli_real_escape_string($con, $_POST['phone']);
$state = mysqli_real_escape_string($con, $_POST['state']);
$city = mysqli_real_escape_string($con, $_POST['city']);
$clinic = mysqli_real_escape_string($con, $_POST['place']);
$message = mysqli_real_escape_string($con, $_POST['message']);
$timestamp = date("d-m-Y g:i a");
$lp = "Clinic Diabetes LP";
if($mobile != "")
{
$sql = "INSERT INTO clinicheart (name,email,phone,state,city,clinic,message,Created_at,lp)
VALUES ('".$patientname."','".$email."','".$mobile."','".$state."','".$city."','".$clinic."','".$message."','".$timestamp."','".$lp."')";
if(mysqli_query($con, $sql)){ } else{   echo "ERROR: Could not able to execute $sql. " . mysqli_error($con);}


// sms patient
$post_data = array( 'username' => 'vaidyasanenew1', 'pass' => 'jQ-@Sm07', 'senderid' => 'MDBAUG', 'dest_mobileno' => ''.$mobile.'', 'dlttempid' => '1507161849047579966', 'message' => 'Your Webinar Registration for Reverse Type 2 Diabetes in 90 Days by Dr Gurudatta Amin is successful

Webinar will be Live on '.$wdate.'

Join Webinar by clicking the link '.$jlink.'

You would need ZOOM App to join the webinar, if its not installed, you can download it from App Store

Thank You
Madhavbaug', 'response' => 'Y', );


$url = "http://www.smsjust.com/sms/user/urlsms.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1); 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_FAILONERROR, 0); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));
$http_result = curl_exec($ch);
curl_close($ch); 

//print_r($http_result);
// sms patient


//email patient
require 'class/class.phpmailer.php';
if($email != "") {
	$mail = new PHPMailer;
	$mail->IsSMTP();								
	$mail->Host = 'mail.madhavbaugclinics.com';	
	$mail->Port = '587';							
	$mail->SMTPAuth = true;						
	$mail->Username = 'mahesh@madhavbaugclinics.com';					
	$mail->Password = 'Mahesh@123##';			
	$mail->SMTPSecure = 'tls';				
	$mail->From = 'info@madhavbaugclinics.com';		
	$mail->FromName = 'Madhavbaug';						
	$mail->AddAddress($email);		
	$mail->WordWrap = 50;							
	$mail->IsHTML(true);								  				
	$mail->Subject = 'Booking successful for Cardiac Stress Test';		
	$mail->Body = 'Dear '.$patientname.',
	<br>
	<br>Your clinic Cardiac Stress Test booking is now confirmed! Our representative will be reaching out to you within the next 48 hours to finalize all the details of your package offer.
	<br>
	<br>
	<br>Thank you
	<br>www.madhavbaug.org';
	$mail->Send();
} else {}
//email patient

?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Booking successful for Clinic Diabetes</title>

	<!-- Your META here -->
	<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0" name="viewport">

	<!-- Stylesheets -->
	<link rel="stylesheet" href="j-folder/css/demo.css">
	<link rel="stylesheet" href="j-folder/css/font-awesome.min.css">
	<link rel="stylesheet" href="j-folder/css/j-forms.css">
	<link href="css/style.css" rel="stylesheet">
	 <link href="css/bootstrap.min.css" rel="stylesheet">
	
	<!-- Scripts -->
	<script src="j-folder/js/jquery.1.11.1.min.js"></script>
	<script src="j-folder/js/jquery.ui.min.js"></script>
	<script src="j-folder/js/jquery.maskedinput.min.js"></script>
	<script src="j-folder/js/jquery.validate.min.js"></script>
	<script src="j-folder/js/jquery.form.min.js"></script>
	<script src="j-folder/js/j-forms.js"></script>

	<!-- Event snippet for Clinic lead form - Medulla conversion page -->
<script>
  gtag('event', 'conversion', {
      'send_to': 'AW-843953390/ii2DCMa-4KYZEO7ptpID',
      'value': 1.0,
      'currency': 'INR'
  });
</script>



<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-WDXX6Z7');</script>
<!-- End Google Tag Manager -->
<!-- Google tag (gtag.js) --> <script async src="
https://www.googletagmanager.com/gtag/js?id=G-MVW2KBC3V1"></script>
<script>   window.dataLayer = window.dataLayer || [];   function gtag(){dataLayer.push(arguments);}   gtag('js', new Date());   gtag('config', 'G-MVW2KBC3V1'); </script>

<style>
@media (max-width: 767px){
  .goback{
     margin-right: 106px !important;
  }
  
  .visitwebsite{
     margin-right: 90px !important;
  }
}
</style>
</head>

<body style="background: url(img/brown-background.jpg) top center no-repeat;
	background-size: cover; height: 100vh;">
	
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WDXX6Z7"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
	
	
<section class="cchome-section" id="home">
	<div class="wrapper wrapper-640">
<center>
<img class="logoimgtop img-fluid" src="img/madhavbaug_logo_l.png">
</center>
		<form action="https://madhavbaug.org/clinic-diabetes/" method="post" class="j-forms" id="j-forms" novalidate>
    <center>
        <div class="ccheader"><strong>Thank you for signing up!</strong><br><?php echo $name; ?></div>
    </center>
    <!-- end /.header-->

    <div class="content">
        <div class="unit">
            <p class="subtext">We'll be in touch to help you avail the offer.</p>
        </div>

        <!-- start response from server -->
        <div id="response"></div>
        <!-- end response from server -->

    </div>
    <!-- end /.content -->

    <div class="footer">
        <a href="https://madhavbaug.org" target="_blank" rel="noopener noreferrer" id="visit-website-btn"><button class="secondary-btn visitwebsite">VISIT WEBSITE</button></a>
        <button type="submit" formaction="https://madhavbaug.org/clinic-diabetes/" class="primary-btn goback">GO BACK</button>
    </div>
	
	<script>
    document.getElementById('visit-website-btn').addEventListener('click', function(event) {
        event.preventDefault(); // Prevent default behavior
        window.open('https://madhavbaug.org', '_blank'); // Open website in a new tab
    });
</script>
    <!-- end /.footer -->
</form>

	</div>
	</section>
	
	<!--begin footer -->
    <div class="footer" style="padding:20px 0 20px 0; position:fixed; bottom:0; width:100%; z-index:999;">
            
        <!--begin container -->
        <div class="container">
        
            <!--begin row -->
            <div class="row">
            
                <!--begin col-md-12 -->
                <div class="col-md-12">
                   
                    <p style="font-family:inherit;">© 2024 <a href="https://madhavbaug.org/" target="_blank">Madhavbaug</a>. All Rights Reserved.</p>
                    
                </div>
                <!--end col-md-12 -->
                
                
                
                
                
            </div>
            <!--end row -->

        </div>
        <!--end container -->
               
    </div>
    <!--end footer -->
	
	
	
	
	
	
</body>

</html>
<?php } else{} ?>