1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| <?php
$db = mysql_connect("localhost","root","");
mysql_select_db("festival", $db) or die(mysql_error());
$nom = htmlentities(mysql_real_escape_string($_POST['nom']));
$prenom = htmlentities(mysql_real_escape_string($_POST['prenom']));
$adresse = htmlentities(mysql_real_escape_string($_POST['adresse']));
$adresse2 = htmlentities(mysql_real_escape_string($_POST['adresse2']));
$cp = htmlentities(mysql_real_escape_string($_POST['cp']));
$ville = htmlentities(mysql_real_escape_string($_POST['ville']));
$code = htmlentities(mysql_real_escape_string($_POST['code']));
$age = htmlentities(mysql_real_escape_string($_POST['age']));
$email = htmlentities(mysql_real_escape_string($_POST['email']));
$situation = htmlentities(mysql_real_escape_string($_POST['situation']));
$_SESSION['email'] = $email;
$_SESSION['nom'] = $nom;
$_SESSION['prenom'] = $prenom;
$date = date('d/m/Y');
$coffret = mysql_query('SELECT count(*) FROM coffret JOIN clients ON coffret.id_client = clients.id_client ');
if ($coffret != 0){
echo "&retour=OK&";
}
$ip = $_SERVER["REMOTE_ADDR"];
$today = mysql_query('SELECT count(*) FROM today WHERE date = $date AND adresseip = $ip');
if ($today != 0){
echo "&retour=OK&";
}
if ($coffret == 0 && $today == 0){
mysql_query('INSERT INTO today VALUE('','$date','$ip','$code')')or die(mysql_error());
mysql_query('INSERT INTO clients VALUE('','$nom','$prenom','$age','$situation','$adresse','$adresse2','$ville','$cp','$email')')or die(mysql_error());
echo "&retour=OK&";
}
mysql_close($db);
?> |
Partager