-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewEventTraitement.php
More file actions
80 lines (56 loc) · 2.09 KB
/
newEventTraitement.php
File metadata and controls
80 lines (56 loc) · 2.09 KB
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
70
71
72
73
74
75
76
77
78
79
80
<?php
//conectionbdd
$server='localhost';
$db='trello';
$login='root';
$mdp='';
// connection alabdd
try {
$linkpdo = new PDO("mysql:host=$server;dbname=$db", $login, $mdp); //chemin de la base de données a ajouter avec login et mdp
}catch (Exception $e) {
die('Erreur : '.$e->getMessage());
}
$nom = $_POST['nom'];
$adresse = $_POST['adresse'];
$ville =$_POST['ville'];
$codeP = $_POST['codeP'];
$date= $_POST['date'];
$heure =$_POST['heure'];
$description =$_POST['description'];
if($_POST['nom'] != null && $_POST['ville']!= null && $_POST['adresse'] != null && $_POST['codeP']!= null && $_POST['date'] != null && $_POST['heure'] && $_POST['description'] =! null ){
$req = $linkpdo -> prepare('insert into evenement (nom , ville , adresse , cp , date , heure , description) values (:nom , :ville , :adresse , :cp , :date , :heure , :description)');
$req -> execute(array('nom' => $nom , 'ville' => $ville , 'adresse' => $adresse , 'cp' => $codeP , 'date' => $date , 'heure' => $heure , 'description' => $description ));
$req = $linkpdo -> prepare('select nom from evenement where nom like :nom');
$req-> execute(array('nom' => $nom));
$res = $req -> fetch();
$res = $res[0];
if($res == null){
?>
<script type="text/javascript">
if (confirm("Les information n'ont pas été saisies correctement! voulez vous recommencer ? ")) {
document.location.href="http://localhost/scan/newEvent.php"
} else {
document.location.href="http://localhost/scan/compteAdmin.php";
}
</script>
<?php
}else{
?>
<script type="text/javascript">
alert("levenement à bien été ajouté");
document.location.href="http://localhost/scan/compteAdmin.php"
</script>
<?php
}
}else{
?>
<script type="text/javascript">
if (confirm("Les information n'ont pas été saisies correctement! voulez vous recommencer ? ")) {
document.location.href="http://localhost/scan/newEvent.php"
} else {
document.location.href="http://localhost/scan/compteAdmin.php";
}
</script>
<?php
}
?>