
<html lang="en">
  <head>
  	<title>Remise -5%</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

	<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,700' rel='stylesheet' type='text/css'>

	<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
	
	<link rel="stylesheet" href="css/style.css">

	</head>
	<body>
	    
	    <?php

$servername = "localhost";
$username = "doquhome";
$password = "30X(;IFrD0RN";
$dbname = "doquhome_convention";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}

$CODE =  rand(100000, 1000000);
$sql = "INSERT INTO VENTE_PRIVEE (NOM_VP, PRENOM_VP,EMAIL_VP,TEL_VP,VILLE_VP,GEN_CODE)
VALUES ('".$_POST["NOM_CIH"]."', '".$_POST["PRENOM_CIH"]."', '".$_POST["EMAIL_CIH"]."', '".$_POST["TEL_CIH"]."', '".$_POST["VILLE_CIH"]."', 'ISK$CODE')";

if ($conn->query($sql) === TRUE) {
    // Multiple recipients
$to = $_POST["EMAIL_CIH"]; // note the comma

// Subject
$subject = 'Remise -5%';
$nom=$_POST["NOM_CIH"];
// Message
$message = '
<html>
<head>
  <title>code - Istikbal Maroc</title>
</head>
<body>
<h1>MERCI '.$nom.' POUR VOTRE INSCRIPTION </h1>
<h2>istikbal vous souhaite la bienvenue !</h2></br>
<h1>Votre Code est : ISK'.$CODE.'</h1>
<p>Merci de rammener cette invitation au magasin pour profiter de la remise<br>
Pour toute information contactez-nous sur le +212 6 19 226 226 </p>
<a href="https://istikbal.co.ma/nos-magasins/"><h3>www.istikbal.co.ma/nos-magasins</h3></a>
 <a href="https://istikbal.co.ma"> <img src="https://istikbal.co.ma/CIH/image2.png"></a>
 
 
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';

// Additional headers
$headers[] = 'To: '.$_POST["NomClient"].' <'.$_POST["EmailClient"].'>';
$headers[] = 'From: istikbal maroc <service.client@istkbal.co.ma>';


// Mail it
mail($to, $subject, $message, implode("\r\n", $headers));
} else {
  echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>

	<section class="ftco-section">
		<div class="container">
			<div class="row justify-content-center">
			
			</div>
			<div class="row justify-content-center">
				<div class="col-md-12">
					<div class="wrapper">
						<div class="row no-gutters">
							<div class="col-lg">
								<div class="contact-wrap w-100 p-md-5 p-4">
								    <center> <img src="logoIstikbal.png" style="width: 40%;padding-bottom: 6%;">	
									<h3><b>MERCI POUR VOTRE INSCRIPTION !</b></h3>
								<p>Vous allez recevoir votre invitation sur e-mail que vous pouvez présenter au magasin pour bénéficier de la remise</p> 
<h1>Votre code est : <?php echo "ISK$CODE"; ?></h1>
								<a href="https://istikbal.co.ma/nos-magasins/">	<Button type="submit" value="" class="btn btn-primary">Localisation magasins</Button></a>
				      		
									<div class="row mb-4">
									
										<div class="col-md-6">
											<div class="dbox w-100 d-flex align-items-start">
						        		<div class="text">
							            <p><span>Email:</span> <a href="mailto:service.client@istikbal.co.ma">service.client@istikbal.co.ma</a></p>
							          </div>
						          </div>
										</div>
										<div class="col-md-6">
											<div class="dbox w-100 d-flex align-items-start">
						        		<div class="text">
							            <p><span>Phone:</span> <a href="tel://0619226226">+212 6 19 225 225</a></p>
							          </div>
						          </div>
										</div>
									</div>
								
									<div class="w-100 social-media mt-5">
										<h3>Suivez-nous ici</h3>
										<p>

											<a href="https://fr-fr.facebook.com/IstikbalMorocco/">Facebook</a>
											<a href="https://www.linkedin.com/company/istikbal-maroc">linkedin</a>
											<a href="https://www.instagram.com/istikbalmaroc/?hl=fr">Instagram</a>
											<a href="https://www.youtube.com/channel/UC9LS3vlaqLOeeFU72yt8dnw">Youtube</a>
										</p>
									</div></center>
								</div>
							</div>
						
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>
	

  <script src="js/jquery.min.js"></script>
  <script src="js/popper.js"></script>
  <script src="js/bootstrap.min.js"></script>
  <script src="js/jquery.validate.min.js"></script>
  <script src="js/main.js"></script>

	</body>
</html>

