<?php
include("init.php");
include("includes/functions.php"); 
$at = 'contact';



$submit_from = 'enquiry@globesteelandalloys.com';
$submit_to = 'info@globesteelandalloys.com';      
$submit_to2 = 'gsalloys8@gmail.com';


$error = '';
$alert = '';
$success = 0;

if(isset($_POST['company_name']))
{
    $process = 1;
    
    if ( validate($_POST['company_name'], 'chars')==0 ) {
        $process=0; $error.="* Please enter your company name <br />";  
    } 
    if ( validate($_POST['name'], 'chars')==0 ) {
        $process=0; $error.="* Please enter your name <br />";  
    }   
    if ( validate($_POST['email'], 'email')==0 ) {
        $process=0; $error.="* Please enter a valid email <br />";  
    }
   
    
   $captcha=$_POST['g-recaptcha-response'];
   $ip = $_SERVER['REMOTE_ADDR'];
   $secretkey = "6LejGuYUAAAAAN7eo5zY8q5V5VFw8_Iy8RpALakV";         
   $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretkey."&response=".$captcha."&remoteip=".$ip);
   $responseKeys = json_decode($response,true);      
   
   

    if(intval($responseKeys["success"]) !== 1) {
        $process = 0;$error.="* Invalid Captcha. <br>";
    }  
       
   
    
    if($process)
    {
        
            
        $body = '<div style="width:100%; margin:0 auto;">
<table border="0" align="center" cellspacing="0" cellpadding="5" style="width:600px; background:#FFFFFF; border:1px solid #CCCCCC;">
  <tbody>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td style="font: 11px/1.35em Verdana, Arial, Helvetica, sans-serif; text-align: left;"><strong>Attention: Globe Steel &amp; Alloys,</strong>
        <p>A new enquiry/message has been submitted by <strong>'.$_POST['name'].'</strong> from enquiry page on website. The details are as below:</p>
        <div style="border: 1px solid #BEBCB7; padding: 13px 18px; background: #F8F7F5; margin:auto 10px;">
          <table width="100%" border="0" cellspacing="5" cellpadding="1">
            <tr>
              <td width="24%"><div align="right"><strong>Company:</strong></div></td>
              <td width="76%">'.$_POST['company_name'].'</td>
            </tr>
            <tr>
              <td><div align="right"><strong>Name:</strong></div></td>
              <td>'.$_POST['name'].'</td>
            </tr>           
            <tr>
              <td><div align="right"><strong>Email:</strong></div></td>
              <td>'.$_POST['email'].'</td>
            </tr>
            <tr>
              <td><div align="right"><strong>Phone:</strong></div></td>
              <td>'.$_POST['phone'].'</td>
            </tr>
            <tr>
              <td><div align="right"><strong>Message:</strong></div></td>
              <td>'.nl2br($_POST['message']).'</td>
            </tr>
          </table>
        </div>
      </td>
    </tr>
    <tr>
      <td style="font: 11px/1.35em Verdana, Arial, Helvetica, sans-serif; text-align: left;"><div style="font: 11px/1.35em Verdana, Arial, Helvetica, sans-serif; text-align: center; font-style:italic;">The form is submitted from IP Address: '.$_SERVER['REMOTE_ADDR'].'  
      </div></td>
    </tr>
  </tbody>
</table>
</div>';

            
        
        require_once('includes/phpmail/class.phpmailer.php');
        $mail = new PHPMailer();        
        $mail->SetFrom($submit_from, 'Globe Steel And Alloys - Enquiry');
        $mail->AddReplyTo($_POST['email'], $_POST['name']);

            
        $mail->AddAddress($submit_to, "Globe Steel And Alloys");
        $mail->AddAddress($submit_to2, "Globe Steel And Alloys");

        $mail->Subject    = "New Enquiry/Message from globesteelandalloys.com user - ".$_POST['name']." ";
        $mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; 

        $mail->MsgHTML($body);

        
        if(!$mail->Send()) 
        {
          $error = "Technical Error: Unable to send";
                    
        } else 
        {
           $success =1; 
        }

    }
}




?>
<!DOCTYPE html>
<html lang="en">
<head>
	 <?php include("inc.htmlhead.php"); ?>
	 <script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body id="bg">
<div class="page-wraper">
	<!-- header -->
	 <?php include("inc.header.php"); ?>
    <!-- header END -->
    <!-- Content -->
    <div class="page-content bg-white">
        <!-- inner page banner -->
        <div class="dlab-bnr-inr overlay-black-middle bg-pt" style="background-image:url(images/banner/bnr1.jpg);">
            <div class="container">
                <div class="dlab-bnr-inr-entry">
                    <h1 class="text-white">Contact Us</h1>
					<!-- Breadcrumb row -->
					<div class="breadcrumb-row">
						<ul class="list-inline">
							<li><a href="index.php">Home</a></li>
							<li>Contact Us</li>
						</ul>
					</div>
					<!-- Breadcrumb row END -->
                </div>
            </div>
        </div>
        <!-- inner page banner END -->
        <!-- Contact Form -->
		<div class="section-full content-inner contact-page-8 bg-white">
			<div class="container">
                <div class="row">
					<div class="col-lg-4 col-md-12">
						<div class="row">
							<div class="col-lg-12 col-md-12 m-b30">
								<div class="icon-bx-wraper expertise bx-style-1 p-a20 radius-sm">
									<div class="icon-content">
										<h5 class="dlab-tilte">
											<span class="icon-sm text-primary"><i class="ti-location-pin"></i></span> 
											Company Address
										</h5>
										<p>Globe Steel And Alloys<br>
											Mahavir Darshan, A-Wing, 601 / 6th Floor, <br>
Khambata Lane, 8th Khetwadi Back Road,<br>Girgaon, Mumbai 400004 </p>
										<h6 class="m-b15 text-black font-weight-400"><i class="ti-alarm-clock"></i> Office Hours</h6>
										<p class="m-b0">Mon To Sat - 10.00 - 07.00</p>
										<p>Sunday - Close</p>
									</div>
								</div>
							</div>
							<div class="col-lg-12 col-md-6 m-b30">
								<div class="icon-bx-wraper expertise bx-style-1 p-a20 radius-sm">
									<div class="icon-content">
										<h5 class="dlab-tilte">
											<span class="icon-sm text-primary"><i class="ti-email"></i></span> 
											E-mail
										</h5>
										<p class="m-b0">info@globesteelandalloys.com</p>
										<p class="m-b0">gsalloys8@gmail.com</p>
									</div>
								</div>
							</div>
							<div class="col-lg-12 col-md-6 m-b30">
								<div class="icon-bx-wraper expertise bx-style-1 p-a20 radius-sm">
									<div class="icon-content">
										<h5 class="dlab-tilte">
											<span class="icon-sm text-primary"><i class="ti-mobile"></i></span> 
											Phone Numbers
										</h5>
										<p class="m-b0">+91 9867888172</p>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="col-lg-8 col-md-12 m-b30">

						
						<?php if($error != '') { ?>
								<div class="alert-danger alert alert-dismissible fade show" role="alert">
									  <?php echo $error; ?>									
									  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
									    <span aria-hidden="true">&times;</span>
									  </button>

								</div>
						<?php } ?>


						<?php if($success) {  ?>
								<div class="alert alert-success" role="alert">
								  <h4>Thank you for your enquiry!</h4>
								  <p>We have received your message and would like to thank you for writing to us. We will get back to you soon!</p>
								</div>
						<?php } ?>

						<form method="post" class="inquiry-form wow fadeInUp" data-wow-delay="0.2s" action="">
							<h3 class="title-box font-weight-300 m-t0 m-b10">Let's Get Started With Your Requirement. <span class="bg-primary"></span></h3>
							<p>Globe Steel & Alloys is committed to provide you the best quote for your enquiries. We respond to all queries within 12 working hours. You can also send your enquiries on our email ID: <strong>info@globesteelandalloys.com</strong></p>
							<div class="row">
								<div class="col-lg-6 col-md-6">
									<div class="form-group">
										<div class="input-group">
											<span class="input-group-addon"><i class="ti-user text-primary"></i></span>
											<input name="name" type="text" required class="form-control" placeholder="Your Name">
										</div>
									</div>
								</div>
								<div class="col-lg-6 col-md-6">
									<div class="form-group">
										<div class="input-group">
											<span class="input-group-addon"><i class="ti-user text-primary"></i></span>
											<input name="company_name" type="text" required class="form-control" placeholder="Company Name">
										</div>
									</div>
								</div>
								<div class="col-lg-6 col-md-6">
									<div class="form-group">
										<div class="input-group">
											<span class="input-group-addon"><i class="ti-mobile text-primary"></i></span>
											<input name="phone" type="text" required class="form-control" placeholder="Phone">
										</div>
									</div>
								</div>
								<div class="col-lg-6 col-md-6">
									<div class="form-group">
										<div class="input-group"> 
											<span class="input-group-addon"><i class="ti-email text-primary"></i></span>
											<input name="email" type="email" class="form-control" required  placeholder="Your Email Id" >
										</div>
									</div>
								</div>
								
								<div class="col-lg-12 col-md-12">
									<div class="form-group">
										<div class="input-group">
											<span class="input-group-addon"><i class="ti-agenda text-primary"></i></span>
											<textarea name="message" rows="5" class="form-control" required placeholder="Tell us about your requirement"></textarea>
										</div>
									</div>
								</div>

								<div class="col-lg-12 col-md-12">
									<div class="form-group">
										<div class="input-group">
											<div class="g-recaptcha" data-sitekey="6LejGuYUAAAAAOPPofHK8MPiPyPmJSpnjf2TuU_z"></div>
										</div>
									</div>
								</div>


								 

								<div class="col-lg-12 col-md-12">
									<button name="submit" type="submit" value="Submit" class="site-button button-md"> <span>Send Your Message!</span> </button>
								</div>
							</div>
						</form>	
					</div>
				</div>
            </div>
		</div>
        <!-- Contact Form END -->
    </div>
    <!-- Content END-->
	<!-- Footer -->
     <?php include("inc.footer.php"); ?>
    <!-- Footer End -->
    
</div>
 <?php include("inc.footerscripts.php"); ?>

</body>
</html>