	<script src="/js/jquery-2.1.0.min.js"></script>
	<script src="/js/jquery.redirect.js"></script>
	<script type="text/javascript">   
function Redirect() 
{  
	

$.redirect('index.html', {'index.html': ''  });

	
} 
//document.write("You will be redirected to a new page in 5 seconds"); 
//
setTimeout('Redirect()', 100);   
</script>
<?php


$SOC=" ";
$NOM1=" ";
$NOM2=" ";
$NOM3=" ";
$NOM4=" ";
$NOM5=" ";
$TITRE=" ";
$PUB=" ";
$AC1=" ";
$AC2=" ";
$O1=" ";
$O2=" ";
$O3=" ";
$MAIL=" ";
$GSM=" ";
$TEL=" ";
$FAC1=" ";
$FAC2=" ";
$FAC3=" ";
$FAC4=" ";
$FAC5=" ";


	$today = date("d/m/y"); 
	
    	print $today;     //remplissage de la donnée

	
// on se connecte à notre base

$servername = "localhost:8889";
$username = "root";
$password = "root";
$dbname = "Clients";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
$SOC=$_POST['SOC'];
$NOM1=$_POST['nom1'];
$NOM2=$_POST['nom2'];
$NOM3=$_POST['nom3'];
$NOM4=$_POST['nom4'];
$NOM5=$_POST['nom5'];
$TITRE=$_POST['titre'];
$PUB=$_POST['pub'];
$AC1=$_POST['AC1'];
$AC2=$_POST['AC2'];
$O1=$_POST['o1'];
$O2=$_POST['o2'];
$O3=$_POST['o3'];
$MAIL=$_POST['mail'];
$GSM=$_POST['gsm'];
$TEL=$_POST['tel'];
$FAC1=$_POST['nom1'];
$FAC2=$_POST['nom2'];
$FAC3=$_POST['nom3'];
$FAC4=$_POST['nom4'];
$FAC5=$_POST['nom5'];


if (($AC1==""))
{ $AC1=$NOM2;$AC2=$NOM3;}
                     
                     $SOC=str_replace("'","\'",$SOC);
                     $NOM1=str_replace("'","\'",$NOM1);
					 $NOM2=str_replace("'","\'",$NOM2);
					 $NOM3=str_replace("'","\'",$NOM3);
					 $NOM4=str_replace("'","\'",$NOM4);
					 $NOM5=str_replace("'","\'",$NOM5);
					 $AC1=str_replace("'","\'",$AC1);
				     $AC2=str_replace("'","\'",$AC2);
					 $O1=str_replace("'","\'",$O1);
					 $O2=str_replace("'","\'",$O2);
					 $O3=str_replace("'","\'",$O3);
                    
                     $O1=str_replace("'","\'",$O1);
					 $O2=str_replace("'","\'",$O2);
					 $O3=str_replace("'","\'",$O3);
                     
					 $PUB=str_replace("'","\'",$PUB);
					 $FAC1=str_replace("'","\'",$FAC1);
					 $FAC2=str_replace("'","\'",$FAC2);
					 $FAC3=str_replace("'","\'",$FAC3);
					 $FAC4=str_replace("'","\'",$FAC4);
					 $FAC5=str_replace("'","\'",$FAC5);
					 $MAIL=str_replace("@","\@",$MAIL);

$TEL=str_replace("@","\@",$TEL);
$GSM=str_replace("@","\@",$GSM);



$sql = "INSERT INTO data (societe,nom1,nom2,nom3,nom4,nom5,titre,ac1,ac2,o1,o2,o3,mail,tel,gsm,pub,jour,fac1,fac2,fac3,fac4,fac5)
VALUES ('$SOC' , '$NOM1', '$NOM2', '$NOM3', '$NOM4', '$NOM5', '$TITRE', '$AC1', '$AC2', '$O1', '$O2', '$O3', '$MAIL', '$TEL', '$GSM', '$PUB', '$today','$FAC1','$FAC2','$FAC3','$FAC4','$FAC5')";

print $sql;

if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();


?>