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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| <?php
if(isset($_POST) && !empty($_POST)){
$base='academia';
$conn=mysql_connect("localhost", "root", "") or die ('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
$db=mysql_select_db($base) or die ('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
$appels='';
if(isset($_POST['appel']) && !empty($_POST['appel'])){
$tableau=array('matin','apres_midi','soiree');
foreach($_POST['appel'] as $k => $appel){
if (in_array($appel, $tableau, true)) {
echo $appels.=$appel.' ';
}else{
}
}
}else{
//rien
}
unset($_POST['appel']);
/*securition du postage*/
foreach($_POST as $k => $v){
$v=mysql_real_escape_string(strip_tags($v));
$_POST[$k]=$v;
}
extract($_POST);
echo $sql="
insert into inscription VALUES (
NULL,
'".$civilite."',
'".$nom."',
'".$prenom."',
'".$email."',
'".$tel."',
'".$formation."',
'".$question."',
'".$appels."',
'".$naissance."',
'".$lieu."',
'".$adresse."',
'".$situation."',
'".$reference."',
'".$autre_ref."',
NOW()
)
";
if($req=mysql_query($sql)){
/*ca marche redirection*/
echo '<script>alert(\'insertion reussie\');</script>';
//header('Location: conf_contact.php');exit;
}else{
die('Erreur SQL !'); /*pas afficher l'erreur sql mysql_error() utilisable par un attaquant*/
}
}else{
//rien de poster
}
?> |
Partager