-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.php
executable file
·266 lines (229 loc) · 11.7 KB
/
server.php
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<?php
require('connect_bdd.php');
session_start();
//Vérification d'identité--------------------------------------------------------------------------------------------------------------------------------------------------
if (isset($_POST['marina']))
{
$nm = htmlspecialchars($_POST['solonanarana']);
$ps = sha1($_POST['tenimiafina']);
$query = new Query_bdd;
$appel_verifcation=$query->verification($nm, $ps);
if ($appel_verifcation == 1)
{
session_start();
$_SESSION['solonanarana'] = $_POST['solonanarana'];
//misintona_insertion---------------------------------------------------------------------------------------------------------------------------------------
$appel_misintona = $query->misintona();
$tab = array();
$i = 0;
while($donne = $appel_misintona->fetch()){
$tab[$i] = $donne;
$i++;
}
$nbr_ligne = count($tab);
$_SESSION["tab"] = $tab;
$_SESSION["nbr"] = $nbr_ligne;
header('location:tableau.php');
}
else{
header('location:admin.php?erreur=true');
}
}
//Ajout de médicaments-------------------------------------------------------------------------------------------------------------------------------------------------
if (isset($_POST['ampidiro']))
{
if ((!empty($_POST['ref']) and (!empty($_POST['anarana']) and (!empty($_POST['isa_amp']) and (!empty($_POST['vidin_irai']) )))))
{
if ( intval(($_POST['ref'])) )
{
$ref = ($_POST['ref']);
$anarana = ($_POST['anarana']);
$query = new Query_bdd;
$appel_verif_refana = $query->verif_refana($ref, $anarana);
$cnt = $appel_verif_refana->rowCount();
if ($cnt > 0){
echo "Efa misy io famantarana na io anarana io";
// header('location:tableau.php?erreur_ref_ana_mitov=true');
}
elseif ($cnt == 0){
if ( intval(($_POST['isa_amp'])) )
{
if ( intval(($_POST['vidin_irai'])))
{
$ref = ($_POST['ref']);
$anarana = ($_POST['anarana']);
$isa_amp = ($_POST['isa_amp']);
$vidin_irai = ($_POST['vidin_irai']);
$appel_insertion=$query->insertion($ref, $anarana, $isa_amp, $vidin_irai);
//misintona_insertion------------------------------------------------------------------------------------------------------------------------------------
$appel_misintona = $query->misintona();
$tab = array();
$i = 0;
while($donne = $appel_misintona->fetch()){
$tab[$i] = $donne;
$i++;
}
$nbr_ligne = count($tab);
$_SESSION["tab"] = $tab;
$_SESSION["nbr"] = $nbr_ligne;
echo true;
}
else{
echo "Hamarino tsara ny vola nampidirinao";
// header('location:tableau.php?erreur_vola=true');
}
}
else{
echo "Hamarino tsara ny isan'ny fanafody nampidirinao";
// header('location:tableau.php?erreur_isa=true');
}
}
}
else{
echo "Ny famantarana dia tokony isa";
// header('location:tableau.php?erreur_reference_int=true');
}
}
else{
echo "Tsy maintsy fenoina daholo!";
//header('location:tableau.php?erreur=true');
}
}
//Hanova fanafody-------------------------------------------------------------------------------------------------------------------------------------------------------------------
if (isset($_POST['manova']))
{
if ((!empty($_POST['ref_v']) and (!empty($_POST['anarana_v']) and (!empty($_POST['isa_amp_v']) and (!empty($_POST['vidin_irai_v']) )))))
{
$ref_v = ($_POST['ref_v']);
$anarana_v = ($_POST['anarana_v']);
if ( intval(($_POST['isa_amp_v'])) )
{
if ( intval(($_POST['vidin_irai_v'])))
{
$ref_v = ($_POST['ref_v']);
$anarana_v = ($_POST['anarana_v']);
$isa_amp_v = ($_POST['isa_amp_v']);
$vidin_irai_v = ($_POST['vidin_irai_v']);
$query = new Query_bdd;
$appel_hanova=$query->hanova_fanafody($ref_v, $isa_amp_v, $vidin_irai_v);
//misintona_insertion------------------------------------------------------------------------------------------------------------------------------------
$appel_misintona = $query->misintona();
$tab = array();
$i = 0;
while($donne = $appel_misintona->fetch()){
$tab[$i] = $donne;
$i++;
}
$nbr_ligne = count($tab);
$_SESSION["tab"] = $tab;
$_SESSION["nbr"] = $nbr_ligne;
echo true;
}
else{
echo "Hamarino tsara ny vola nampidirinao";
// header('location:tableau.php?erreur_vola=true');
}
}
else{
echo "Hamarino tsara ny isan'ny fanafody nampidirinao";
// header('location:tableau.php?erreur_isa=true');
}
}
else{
echo "Tsy maintsy fenoina daholo!";
//header('location:tableau.php?erreur=true');
}
}
//hamafa-------------------------------------------------------------------------------------------------------------------------------------------------------
if (isset($_GET['id'])) {
$id = htmlspecialchars($_GET['id']);
$query = new Query_bdd;
$appel_mamafa = $query->mamafa($id);
if ($appel_mamafa === false) {
echo 'error_supp';
}
else{
$appel_misintona = $query->misintona();
$tab = array();
$i = 0;
while($donne = $appel_misintona->fetch()){
$tab[$i] = $donne;
$i++;
}
echo true;
$nbr_ligne = count($tab);
$_SESSION["tab"] = $tab;
$_SESSION["nbr"] = $nbr_ligne;
}
}
//recherche de fanafody-----------------------------------------------------------------------------------------------------------------------------------------
if (isset($_POST['btnmitad']))
{
if ( (!empty($_POST['fanaf_recherche']) ))
{
$fanafody = ($_POST['fanaf_recherche']);
$query = new Query_bdd;
$appel_mitady = $query->recherche($fanafody);
$tabr = array();
$i = 0;
while($donne = $appel_mitady->fetch()){
$tabr[$i] = $donne;
$i++;
}
echo json_encode($tabr);
}
else{
header('location:tableau.php?erreur_recherche=true');
}
}
//hamandrika fanafody-----------------------------------------------------------------------------------------------------------------------------------------------------------
if (isset($_POST['fandrika']))
{
if ((!empty($_POST['an_mp']) and (!empty($_POST['fan_mp']) and (!empty($_POST['kara_mp']) and (!empty($_POST['adr_mp']) and (!empty($_POST['find_mp']) and (!empty($_POST['an_fn']) and (!empty($_POST['isa_fn']) ))))))))
{
if ( (intval(($_POST['kara_mp']))) and ((strlen($_POST['kara_mp'])) == 14))
{
if ( (intval(($_POST['find_mp']))) and ((strlen($_POST['find_mp'])) == 10 ))
{
if ( intval(($_POST['isa_fn'])))
{
$an_mp = ($_POST['an_mp']);
$fan_mp = ($_POST['fan_mp']);
$kara_mp = ($_POST['kara_mp']);
$adr_mp = ($_POST['adr_mp']);
$find_mp = ($_POST['find_mp']);
$an_fn = ($_POST['an_fn']);
$isa_fn = ($_POST['isa_fn']);
$query = new Query_bdd;
$appel_hamandrika = $query->hamandrika($an_mp, $fan_mp, $kara_mp, $adr_mp, $find_mp, $an_fn, $isa_fn);
$code_crypt = sha1($appel_hamandrika);
$x = exec("python qrgen.py $code_crypt");
echo $x;
// include('./phpqrcode/qrlib.php'); //On inclut la librairie au projet
// $lien='https://www.243tech.com'; // Vous pouvez modifier le lien selon vos besoins
// QRcode::png($lien, 'image-qrcode.png'); // On crée notre QR Code
// header("location:image-qrcode.png");
}
else{
echo "Hamarino tsara ny isan'ny fanafody nampidirinao";
}
}
else{
echo "Hamarino tsara ny laharan'ny findainao";
}
}
else{
echo "Hamarino tsara ny laharan'ny kara-panondronao";
}
}
else{
echo "Tsy maintsy fenoina daholo ny banga";
}
}
//deconnexion----------------------------------------------------------------------------------------------------------------------------------
if (isset($_GET['deconnection'])) {
session_start();
$_SESSION = array ();
session_destroy();
header('location:index.php');
}