-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompteAdmin.php
More file actions
162 lines (107 loc) · 3.62 KB
/
compteAdmin.php
File metadata and controls
162 lines (107 loc) · 3.62 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Compte admin</title>
<link rel="stylesheet" type="text/css" href="compteAdmin.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- Popper JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
</head>
<body>
<header>
<h1>Bienvenue Admin</h1>
</header>
<div class="container-fluid">
<?php afficherEvenement() ;?>
</div>
</body>
</html>
<?php
function afficherEvenement( ){
$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());
}
//recupere le nombre devenement
$req = $linkpdo -> prepare('select count(*) from evenement ');
$req -> execute();
$nombreEvenement = $req -> fetch();
$nombreEvenement = $nombreEvenement[0];
?>
<!-- remplie les titre des colonnes -->
<table class="table table-bordered ">
<thead class="thead-dark">
<tr>
<th scope="col">Date</th>
<th scope="col">Adresse</th>
<th scope="col">Heure</th>
<th scope="col">Description</th>
<th scope="col">Nom</th>
<th scope="col">Code Postale</th>
<th scope="col">Ville</th>
<th scope="col">Surpimmer !</th>
</tr>
</thead>
<?php
//recupere toute la liste des evenements
$req = $linkpdo -> prepare('select * from evenement ');
$req -> execute();
// affiches les informations
$i = 0;
while($i < $nombreEvenement) {
$data= $req-> fetch();
$i = $i +1 ;
?>
<tbody>
<tr>
<!-- <td><button type="button" class="btn btn-secondary" onclick="voirInfo(<?php echo $i ?> )"> <?php echo $i ?> </button></td> -->
<td><?php echo $data[0] ?> </td>
<td><?php echo $data[1] ?></td>
<td><?php echo $data[2] ?></td>
<td><?php echo $data[3] ?></td>
<td>
<form method="post" action="infoParticipant">
<input type="submit" name="nomEvent" value="<?php echo $data[4] ?>">
</form>
</td>
<td><?php echo $data[5] ?></td>
<td><?php echo $data[6] ?></td>
<!-- <td><button type="button" class="btn btn-primary" onclick="Surpimmer()">Surpimmer</button></td> -->
<td>
<a href="deletEvent.php?nomEvent=<?php echo $data[4]?>" class="btn btn-primary"> delete</a>
</tr>
<?php
}
?>
</tbody>
</table>
<button type="button" class="btn btn-success" onclick="newEvent()">Ajouter un nouvel event</button>
<button type="button" onclick="deco()" class="btn btn-default"> Deconnection</button>
<?php
}
?>
<script type="text/javascript">
function voirInfo(nombre){
// recupere le nom de levenement
var evenement = document.getElementsByTagName('table')[0].getElementsByTagName('tr')[nombre].cells[5].innerHTML;
}
function newEvent(){
document.location.href="http://localhost/scan/newEvent.php"
}
function deco(){
document.location.href="http://localhost/scan/index.php"
}
</script>