ryxeo-glpi-git / htdocs / epack / commande.php @ f287df44
Historique | Voir | Annoter | Télécharger (14 ko)
1 |
<?php
|
---|---|
2 |
// Commande un epack pour un grossiste
|
3 |
//Vite une session
|
4 |
session_start(); |
5 |
if(trim($_GET['reset']) != "") { |
6 |
// Finalement, on détruit la session.
|
7 |
session_destroy(); |
8 |
header('Location: http://abuledu.net/epack/commande/'); |
9 |
} |
10 |
//print_r($_SESSION);
|
11 |
//destroy($_SESSION);
|
12 |
//print_r($_SESSION);
|
13 |
|
14 |
//recupration des variables de l'url
|
15 |
$g_http_request = $_SERVER['REQUEST_URI']; |
16 |
if($_SESSION['epack_session'] > 0) { |
17 |
if(isset($_POST['login_email'])) { |
18 |
$login_email = $_POST['login_email']; |
19 |
$login_pass = $_POST['login_pass']; |
20 |
} |
21 |
if(isset($_SESSION['login_email'])) { |
22 |
$login_email = $_SESSION['login_email']; |
23 |
$login_pass = $_SESSION['login_pass']; |
24 |
} |
25 |
} |
26 |
else {
|
27 |
ereg(".*lepass=(.*).identifiant=(.*)",$_SERVER['REQUEST_URI'],$regs); |
28 |
$lepass = addslashes($regs[1]); |
29 |
$identifiant = addslashes(strtoupper($regs[2])); |
30 |
//Ou du POST
|
31 |
if(trim($lepass) == "" || trim($identifiant) == "") { |
32 |
$lepass = addslashes($_POST['lepass']); |
33 |
$identifiant = addslashes(strtoupper($_POST['identifiant'])); |
34 |
} |
35 |
} |
36 |
$_SERVER['REQUEST_URI'] = ""; |
37 |
$_SERVER['HTTP_REFERER'] = ""; |
38 |
define('GLPI_ROOT', '..'); |
39 |
include (GLPI_ROOT . "/inc/includes.php"); |
40 |
|
41 |
include "ryxeo.php"; |
42 |
include "header.php"; |
43 |
//reset ...
|
44 |
//print_r($_POST);
|
45 |
//unset($_SESSION['epack_session']);
|
46 |
|
47 |
// On a remplis les coordonnées d'un revendeur
|
48 |
if($_SESSION['epack_session'] == 3) { |
49 |
if( isset($_POST['modify'])) |
50 |
$_SESSION['epack_session'] = 1; |
51 |
else if( isset($_POST['confirm'])) { |
52 |
$_SESSION['epack_session'] = 4; |
53 |
|
54 |
$message .= "<p>Merci,<br />cette commande est enregistré pour le revendeur <b>" . $_POST[''] . "</b>.</p>"; |
55 |
|
56 |
//Le mail d'info pour ryxéo
|
57 |
$mail_content = " |
58 |
Bonjour,
|
59 |
une nouvelle commande de epacks abuledu vient d'être faite
|
60 |
|
61 |
le pack $pass :: $code a été créé à l'instant avec le compte utilisateur suivant:
|
62 |
" . addslashes($_SESSION['login_email']) . " |
63 |
pour le client final suivant:
|
64 |
" . addslashes($data2['name']) . " |
65 |
" . addslashes($data2['address']) . " |
66 |
" . addslashes($data2['postcode']) . " " . addslashes($data2['town']) . " |
67 |
tel: " . addslashes($data2['phonenumber']) . " fax: " . addslashes($data2['fax']) . " |
68 |
email: " . addslashes($data2['email']) . " |
69 |
|
70 |
Allez sur https://secure.ryxeo.com/glpi/index2.php dans le plugin anet_epack à la recherche du pack
|
71 |
en question et cliquez sur le lien epack activé, sauvegardez ce fichier et envoyez en une version PDF
|
72 |
à cet installateur.
|
73 |
|
74 |
--
|
75 |
abuledu.net est un service de RyXéo SARL, société éditrice d'AbulÉdu
|
76 |
|
77 |
";
|
78 |
ryxeo_mail($_SESSION['login_email'],$mail_content,"contact@ryxeo.com","Nouveau pack activé sur abuledu.net"); |
79 |
|
80 |
|
81 |
//L'accusé pour la personne qui vient de faire l'enregistrement ...
|
82 |
$mail_content = " |
83 |
Bonjour,
|
84 |
vous venez d'activer le pack $pass :: $code à l'instant avec le compte utilisateur suivant:
|
85 |
" . addslashes($_SESSION['login_email']) . " |
86 |
pour le client final:
|
87 |
" . addslashes($data2['name']) . " |
88 |
" . addslashes($data2['address']) . " |
89 |
" . addslashes($data2['postcode']) . " " . addslashes($data2['town']) . " |
90 |
tel: " . addslashes($data2['phonenumber']) . " fax: " . addslashes($data2['fax']) . " |
91 |
email: " . addslashes($data2['email']) . " |
92 |
|
93 |
L'équipe de validation de RyXéo a été informée de cette activation.
|
94 |
|
95 |
--
|
96 |
abuledu.net est un service de RyXéo SARL, société éditrice d'AbulÉdu
|
97 |
|
98 |
";
|
99 |
ryxeo_mail("anet@ryxeo.com",$mail_content,$_SESSION['login_email'], $code . " :: Nouveau pack activé sur abuledu.net"); |
100 |
|
101 |
|
102 |
} |
103 |
else
|
104 |
$_SESSION['epack_session'] = 2; |
105 |
} |
106 |
|
107 |
if($_SESSION['epack_session'] == 2) { |
108 |
$_SESSION['rvd_company'] = $_POST['rvd_company']; |
109 |
$_SESSION['rvd_email'] = $_POST['rvd_email']; |
110 |
$_SESSION['rvd_web'] = $_POST['rvd_web']; |
111 |
$_SESSION['rvd_tel'] = $_POST['rvd_tel']; |
112 |
$_SESSION['rvd_fax'] = $_POST['rvd_fax']; |
113 |
$_SESSION['rvd_adresse'] = $_POST['rvd_adresse']; |
114 |
$_SESSION['rvd_cp'] = $_POST['rvd_cp']; |
115 |
$_SESSION['rvd_ville'] = $_POST['rvd_ville']; |
116 |
$_SESSION['rvd_nb_epack'] = $_POST['rvd_nb_epack']; |
117 |
$_SESSION['rvd_srv'] = $_POST['rvd_srv']; |
118 |
$_SESSION['rvd_quinze'] = $_POST['rvd_quinze']; |
119 |
$_SESSION['rvd_dix'] = $_POST['rvd_dix']; |
120 |
$_SESSION['rvd_duree_maint'] = $_POST['rvd_duree_maint']; |
121 |
$_SESSION['commentaires'] = $_POST['commentaires']; |
122 |
// $_SESSION['rvd_'] = $_POST['rvd_'];
|
123 |
|
124 |
$message .= "<h4> Vérification avant commande définitive</h4> |
125 |
|
126 |
<p>Vérifiez que les informations suivantes sont correctes avant de cliquer sur le bouton de commande définitive.</p>
|
127 |
|
128 |
<form name=\"form\" action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\"> |
129 |
<table style=\"margin-left:0; margin-right:auto;\">
|
130 |
<tr>
|
131 |
<th colspan=\"2\">Informations générales</th>
|
132 |
</tr>
|
133 |
<tr>
|
134 |
<td>Entreprise</td>
|
135 |
<td>" . $_SESSION['rvd_company'] . "</td> |
136 |
</tr>
|
137 |
<tr>
|
138 |
<td>Email (adresse générique de l'entreprise)</td>
|
139 |
<td>" . $_SESSION['rvd_email'] . "</td> |
140 |
</tr>
|
141 |
<tr>
|
142 |
<td>Site web</td>
|
143 |
<td>" . $_SESSION['rvd_web'] . "</td> |
144 |
</tr>
|
145 |
<tr>
|
146 |
<td>Tel</td>
|
147 |
<td>" . $_SESSION['rvd_tel'] . "</td> |
148 |
</tr>
|
149 |
<tr>
|
150 |
<td>Fax</td>
|
151 |
<td>" . $_SESSION['rvd_fax'] . "</td> |
152 |
</tr>
|
153 |
<tr>
|
154 |
<td>Adresse</td>
|
155 |
<td>" . $_SESSION['rvd_adresse'] . "</td> |
156 |
</tr>
|
157 |
<tr>
|
158 |
<td>Code postal</td>
|
159 |
<td>" . $_SESSION['rvd_cp'] . "</td> |
160 |
</tr>
|
161 |
<tr>
|
162 |
<td>Ville</td>
|
163 |
<td>" . $_SESSION['rvd_ville'] . "</td> |
164 |
</tr>
|
165 |
<tr>
|
166 |
<td>Nombre de ePacks pour ce revendeur ?</td>
|
167 |
<td>" . $_SESSION['rvd_nb_epack'] . "</td> |
168 |
</tr>
|
169 |
<tr>
|
170 |
<td>Type et modèle de serveur</td>
|
171 |
<td>" . $_SESSION['rvd_srv'] . "</td> |
172 |
</tr>
|
173 |
<tr>
|
174 |
<td>Type et modèle de portables 15 pouces</td>
|
175 |
<td>" . $_SESSION['rvd_quinze'] . "</td> |
176 |
</tr>
|
177 |
<tr>
|
178 |
<td>Type et modèle de portables 10 pouces</td>
|
179 |
<td>" . $_SESSION['rvd_dix'] . "</td> |
180 |
</tr>
|
181 |
<tr>
|
182 |
<td>Durée de maintenance</td>
|
183 |
<td>" . $_SESSION['rvd_duree_maint'] . "</td> |
184 |
</tr>
|
185 |
<tr>
|
186 |
<td>Commentaires</td>
|
187 |
<td>" . $_SESSION['commentaires'] . "</td> |
188 |
</tr>
|
189 |
<tr>
|
190 |
<td colspan=\"3\" style=\"text-align: center;\"><input name=\"modify\" type=\"submit\" value=\"Modifier la commande\"> - <input name=\"confirm\" type=\"submit\" value=\"Commande définitive\"></td>
|
191 |
</tr>
|
192 |
</table>
|
193 |
</form>
|
194 |
";
|
195 |
$_SESSION['epack_session'] = 3; |
196 |
} |
197 |
|
198 |
// On a validé le formulaire d'authentification
|
199 |
if($_SESSION['epack_session'] == 1) { |
200 |
//Code saisi ...
|
201 |
if(trim($login_email) != "" && trim($login_pass) != "") { |
202 |
$query = "SELECT gu.ID as userid,firstname,realname,FK_entities,g.name as company, g.completename as completename FROM glpi_users as gu |
203 |
LEFT JOIN glpi_entities AS g ON FK_entities=g.ID
|
204 |
WHERE gu.name='" . $login_email . "' AND gu.password_md5='" . md5($login_pass) . "'"; |
205 |
|
206 |
$result = $DB->query($query); |
207 |
$data=$DB->fetch_assoc($result); |
208 |
if($DB->numrows($result)>0) { |
209 |
$_SESSION['login_email'] = $login_email; |
210 |
$_SESSION['login_pass'] = $login_pass; |
211 |
|
212 |
$message .= "<div> |
213 |
<h2>Nouvelle commande de ePack AbulÉdu</h2>
|
214 |
<p>Merci de compléter le formulaire ci-dessous en indiquant les coordonnées de votre client (revendeur informatique, pas celles du client final).</p>
|
215 |
<form name=\"form\" action=\"\" method=\"post\">
|
216 |
<input type=\"hidden\" name=\"epack_commande\" value=\"1\">
|
217 |
|
218 |
<script type=\"text/javascript\" src=\"/epack/validate.js\"></script>
|
219 |
<form name=\"form1\" id=\"form1\" action=\"\" method=\"post\" action=\"\" onSubmit=\"return validate();\">
|
220 |
<table style=\"margin-left:0; margin-right:auto;\">
|
221 |
<tr>
|
222 |
<th colspan=\"3\">Informations générales</th>
|
223 |
</tr>
|
224 |
<tr>
|
225 |
<td>Entreprise</td>
|
226 |
<td><input type=\"text\" name=\"rvd_company\" class=\"validate required none companymsg\" value=\"" . $_SESSION['rvd_company'] . "\"></td> |
227 |
<td id=\"companymsg\" class=\"rules\">Requis</td>
|
228 |
</tr>
|
229 |
<tr>
|
230 |
<td>Email (adresse générique de l'entreprise)</td>
|
231 |
<td><input type=\"text\" name=\"rvd_email\" class=\"validate required email emailmsg\" value=\"" . $_SESSION['rvd_email'] . "\"></td> |
232 |
<td id=\"emailmsg\">Requis</td>
|
233 |
</tr>
|
234 |
<tr>
|
235 |
<td>Site web</td>
|
236 |
<td><input type=\"text\" name=\"rvd_web\" class=\"validate required web webmsg\" value=\"" . $_SESSION['rvd_web'] . "\"></td> |
237 |
<td id=\"webmsg\">Facultatif</td>
|
238 |
</tr>
|
239 |
<tr>
|
240 |
<td>Tel</td>
|
241 |
<td><input type=\"text\" name=\"rvd_tel\" class=\"validate required phone telmsg\" value=\"" . $_SESSION['rvd_tel'] . "\"></td> |
242 |
<td id=\"telmsg\">Requis</td>
|
243 |
</tr>
|
244 |
<tr>
|
245 |
<td>Fax</td>
|
246 |
<td><input type=\"text\" name=\"rvd_fax\" class=\"validate required phone faxmsg\" value=\"" . $_SESSION['rvd_fax'] . "\"></td> |
247 |
<td id=\"faxmsg\">Facultatif</td>
|
248 |
</tr>
|
249 |
<tr>
|
250 |
<td>Adresse</td>
|
251 |
<td><textarea name=\"rvd_adresse\" class=\"validate required none adressemsg\">". $_SESSION['rvd_adresse'] . "</textarea></td> |
252 |
<td id=\"adressemsg\">Requis</td>
|
253 |
</tr>
|
254 |
<tr>
|
255 |
<td>Code postal</td>
|
256 |
<td><input type=\"text\" name=\"rvd_cp\" class=\"validate required none cpmsg\" value=\"" . $_SESSION['rvd_cp'] . "\"></td> |
257 |
<td id=\"cpmsg\">Requis</td>
|
258 |
</tr>
|
259 |
<tr>
|
260 |
<td>Ville</td>
|
261 |
<td><input type=\"text\" name=\"rvd_ville\" class=\"validate required none villemsg\" value=\"" . $_SESSION['rvd_ville'] . "\"></td> |
262 |
<td id=\"villemsg\">Requis</td>
|
263 |
</tr>
|
264 |
<tr>
|
265 |
<td>Nombre de ePacks pour ce revendeur ?</td>
|
266 |
<td><input type=\"text\" name=\"rvd_nb_epack\" value=\"" . $_SESSION['rvd_nb_epack'] . "\"></td> |
267 |
</tr>
|
268 |
<tr>
|
269 |
<th colspan=\"3\">Modèle de serveur</th>
|
270 |
</tr>
|
271 |
<tr>
|
272 |
<td>Rappel: <br /> - 2 disques durs de 500Go <br/> - 2 cartes réseaux minimum</td>
|
273 |
<td>\n";
|
274 |
if(isset($_SESSION['rvd_srv'])) |
275 |
$message .=" |
276 |
<label><input type=\"radio\" name=\"rvd_srv\" value=\"" . $_SESSION['rvd_srv'] . "\" checked> <b>" . $_SESSION['rvd_srv'] . "</b></label><br />\n"; |
277 |
|
278 |
$message .=" |
279 |
<label><input type=\"radio\" name=\"rvd_srv\" value=\"Lenovo TS200\"> Lenovo TS200</label><br />
|
280 |
<label><input type=\"radio\" name=\"rvd_srv\" value=\"Lenovo TS200v\"> Lenovo TS200v</label><br />
|
281 |
<label><input type=\"radio\" name=\"rvd_srv\" value=\"Autre\"> Autre: nous contacter</label><br />
|
282 |
</td>
|
283 |
</tr>
|
284 |
<tr>
|
285 |
<th colspan=\"3\">Maquettes des postes clients</th>
|
286 |
</tr>
|
287 |
<tr>
|
288 |
<td style=\"background-color: #fafafa; vertical-align: top\">Maquettes 15 pouces</td>
|
289 |
<td style=\"background-color: #fafafa;\">\n";
|
290 |
if(isset($_SESSION['rvd_quinze'])) |
291 |
$message .=" |
292 |
<label><input type=\"radio\" name=\"rvd_quinze\" value=\"" . $_SESSION['rvd_quinze'] . "\" checked> <b>" . $_SESSION['rvd_quinze'] . "</b></label><br />\n"; |
293 |
|
294 |
$message .=" |
295 |
<label><input type=\"radio\" name=\"rvd_quinze\" value=\"\"> Aucune</label><br />
|
296 |
<label><input type=\"radio\" name=\"rvd_quinze\" value=\"Lenovo SL500 P/N : 4414WAV\"> Lenovo SL500 P/N : 4414WAV</label><br />
|
297 |
<label><input type=\"radio\" name=\"rvd_quinze\" value=\"Lenovo SL500c P/N : 4414W33\"> Lenovo SL500c P/N : 4414W33</label><br />
|
298 |
<label><input type=\"radio\" name=\"rvd_quinze\" value=\"LENOVO L510 P/N: 2873W2X\"> Lenovo L510 P/N: 2873W2X</label><br />
|
299 |
<label><input type=\"radio\" name=\"rvd_quinze\" value=\"Toshiba L500-1UR P/N : PSLS0E-06T01FFR\"> Toshiba L500-1UR P/N : PSLS0E-06T01FFR</label><br />
|
300 |
<label><input type=\"radio\" name=\"rvd_quinze\" value=\"Autre\"> Autre: nous contacter</label><br />
|
301 |
</td>
|
302 |
</tr>
|
303 |
<tr><td style=\"background-color: #afafaf; vertical-align: top;\">Maquettes 10 pouces</td>
|
304 |
<td style=\"background-color: #afafaf;\">\n";
|
305 |
if(isset($_SESSION['rvd_dix'])) |
306 |
$message .=" |
307 |
<label><input type=\"radio\" name=\"rvd_dix\" value=\"" . $_SESSION['rvd_dix'] . "\" checked> <b>" . $_SESSION['rvd_dix'] . "</b></label><br />\n"; |
308 |
|
309 |
$message .=" |
310 |
<label><input type=\"radio\" name=\"rvd_dix\" value=\"\"> Aucune</label><br />
|
311 |
<label><input type=\"radio\" name=\"rvd_dix\" value=\"Lenovo S10 P/N : 40684XG\"> Lenovo S10 P/N : 40684XG</label><br />
|
312 |
<label><input type=\"radio\" name=\"rvd_dix\" value=\"Lenovo S10-2 P/N : 2957 \"> Lenovo S10-2 P/N : 2957 </label><br />
|
313 |
<label><input type=\"radio\" name=\"rvd_dix\" value=\"Toshiba NB200 P/N : PLL25E-00500KFR\"> Toshiba NB200 P/N : PLL25E-00500KFR</label><br />
|
314 |
<label><input type=\"radio\" name=\"rvd_dix\" value=\"Toshiba NB300 P/N : PLL3EE-00D00XFR\"> Toshiba NB300 P/N : PLL3EE-00D00XFR</label><br />
|
315 |
<label><input type=\"radio\" name=\"rvd_dix\" value=\"Autre\"> Autre: nous contacter</label><br />
|
316 |
</td>
|
317 |
</tr>
|
318 |
<tr><th colspan=\"3\">Durée de la maintenance</td></tr>
|
319 |
<tr><td>Maintenance</td>
|
320 |
<td>\n";
|
321 |
if(isset($_SESSION['rvd_duree_maint'])) |
322 |
$message .=" |
323 |
<label><input type=\"radio\" name=\"rvd_duree_maint\" value=\"" . $_SESSION['rvd_duree_maint'] . "\" checked> <b>" . $_SESSION['rvd_duree_maint'] . "</b></label><br />\n"; |
324 |
else
|
325 |
$message .=" |
326 |
<label><input type=\"radio\" name=\"rvd_duree_maint\" value=\"12 mois\" checked> 12 mois</label><br />\n";
|
327 |
|
328 |
$message .=" |
329 |
<label><input type=\"radio\" name=\"rvd_duree_maint\" value=\"12 mois\"> 12 mois</label><br />
|
330 |
<label><input type=\"radio\" name=\"rvd_duree_maint\" value=\"24 mois\"> 24 mois</label><br />
|
331 |
<label><input type=\"radio\" name=\"rvd_duree_maint\" value=\"36 mois\"> 36 mois</label><br />
|
332 |
</td>
|
333 |
</tr>
|
334 |
<tr><th colspan=\"3\">Commentaires</td></tr>
|
335 |
<tr>
|
336 |
<td>Commentaires</td>
|
337 |
<td><textarea name=\"commentaires\">" . $_SESSION['commentaires'] . "</textarea></td> |
338 |
</tr>
|
339 |
<tr><td colspan=\"3\" style=\"text-align: center;\"><input type=\"submit\" value=\"Commander\"></td></tr>
|
340 |
</table>
|
341 |
</form>
|
342 |
|
343 |
</div>\n";
|
344 |
$_SESSION['epack_session'] = 2; |
345 |
} |
346 |
else {
|
347 |
$message .= "<p><font color=\"red\">Erreur, Identifiant ou mot de passe incorrect.</font> <a href=\"mailto:commercial@ryxeo.com\">Contactez nous</a> de toute urgence pour régler ce problème.</p>\n"; |
348 |
unset($_SESSION['epack_session']); |
349 |
} |
350 |
} |
351 |
else {
|
352 |
unset($_SESSION['epack_session']); |
353 |
} |
354 |
} |
355 |
if(!isset($_SESSION['epack_session']) || ($_SESSION['epack_session'] == 0)){ |
356 |
$_SESSION['epack_session'] = 1; |
357 |
$pass = "non encore enregistré"; |
358 |
$message .= "<h1>Accès grossistes</h1>\n"; |
359 |
$message .= "<form name=\"form\" action=\"\" method=\"post\"> |
360 |
<table align=\"left\">
|
361 |
<tr>
|
362 |
<td>
|
363 |
Identifiant
|
364 |
</td>
|
365 |
<td>
|
366 |
<input type=\"text\" name=\"login_email\" size=\"20\">
|
367 |
</td>
|
368 |
</tr>
|
369 |
<tr>
|
370 |
<td>
|
371 |
Mot de passe
|
372 |
</td>
|
373 |
<td>
|
374 |
<input type=\"password\" name=\"login_pass\" size=\"20\">
|
375 |
</td>
|
376 |
</tr>
|
377 |
<tr>
|
378 |
<td align=\"center\" colspan=\"2\"> <input type=\"submit\" value=\"Ouvrir une session\"> </td>
|
379 |
</tr>
|
380 |
</table>
|
381 |
</form>\n";
|
382 |
} |
383 |
|
384 |
print $message; |
385 |
|
386 |
//print_r($_SERVER);
|
387 |
|
388 |
include "footer.php"; |
389 |
?>
|