ryxeo-glpi-git / htdocs / epack / register.php @ e213dd82
Historique | Voir | Annoter | Télécharger (29 ko)
1 | 1c14bcc4 | Eric Seigne | <?php
|
---|---|---|---|
2 | //AJAX CODE
|
||
3 | |||
4 | $commande = ""; |
||
5 | $message = ""; |
||
6 | e213dd82 | root | $debug = ""; |
7 | 1c14bcc4 | Eric Seigne | $send_mail = 0; //flag pour savoir s'il faut envoyer un mail (en bref a toute insertion ou update de base) |
8 | |||
9 | abd6eaaa | Eric Seigne | function make_pdf($pass,$code,$datapost) { |
10 | global $message; |
||
11 | af8e09aa | Eric Seigne | global $login_email; |
12 | abd6eaaa | Eric Seigne | require_once('lib/odf.php'); |
13 | $odf = new odf("abuledu-base_genere_automatiquement_enregistrement_epack.odp"); |
||
14 | |||
15 | //1ere page
|
||
16 | setlocale(LC_TIME, "fr_FR.UTF-8"); |
||
17 | // $odf->setVars('date', strftime("%A %e %B %Y"));
|
||
18 | $odf->setVars('date_installation', $datapost['IDATE']); |
||
19 | $odf->setVars('date', date("d/m/Y")); |
||
20 | |||
21 | //Le epack
|
||
22 | $odf->setVars('epack_pass', $pass); |
||
23 | $odf->setVars('epack_code', $code); |
||
24 | |||
25 | //Les mots de passes
|
||
26 | $odf->setVars('pass_root', $datapost['IROOT']); |
||
27 | $odf->setVars('pass_abuladmin', $datapost['IABE']); |
||
28 | |||
29 | //L'école
|
||
30 | $odf->setVars('ecole_nom', $datapost['INAME'], true, 'UTF-8'); |
||
31 | $odf->setVars('ecole_adresse', $datapost['IADDRESS0'], true, 'UTF-8'); |
||
32 | $odf->setVars('ecole_cp', $datapost['IPOSTALCODE'], true, 'UTF-8'); |
||
33 | $odf->setVars('ecole_ville', $datapost['ICITY'], true, 'UTF-8'); |
||
34 | $odf->setVars('ecole_pays', $datapost['ICOUNTRY'], true, 'UTF-8'); |
||
35 | $odf->setVars('ecole_tel', $datapost['ITEL'], true, 'UTF-8'); |
||
36 | $odf->setVars('ecole_email', $datapost['IEMAIL'], true, 'UTF-8'); |
||
37 | |||
38 | //Le serveur
|
||
39 | $odf->setVars('srv_srv', $datapost['ISRV'], true, 'UTF-8'); |
||
40 | $odf->setVars('srv_serial', $datapost['ISERIAL'], true, 'UTF-8'); |
||
41 | $odf->setVars('srv_cpu', $datapost['CPU'], true, 'UTF-8'); |
||
42 | $odf->setVars('srv_ram', $datapost['RAM'], true, 'UTF-8'); |
||
43 | $odf->setVars('srv_hdd0', $datapost['HDD0'], true, 'UTF-8'); |
||
44 | $odf->setVars('srv_hdd1', $datapost['HDD1'], true, 'UTF-8'); |
||
45 | $odf->setVars('srv_eth0', $datapost['MAC0'], true, 'UTF-8'); |
||
46 | $odf->setVars('srv_eth1', $datapost['MAC1'], true, 'UTF-8'); |
||
47 | |||
48 | //L'admin local
|
||
49 | $odf->setVars('adm_prenom', $datapost['ADM_FIRSTNAME'], true, 'UTF-8'); |
||
50 | $odf->setVars('adm_nom', $datapost['ADM_LASTNAME'], true, 'UTF-8'); |
||
51 | $odf->setVars('adm_email', $datapost['ADM_EMAIL'], true, 'UTF-8'); |
||
52 | |||
53 | //La personne ressource
|
||
54 | $odf->setVars('pr_prenom', $datapost['PR_FIRSTNAME'], true, 'UTF-8'); |
||
55 | $odf->setVars('pr_nom', $datapost['PR_LASTNAME'], true, 'UTF-8'); |
||
56 | $odf->setVars('pr_email', $datapost['PR_EMAIL'], true, 'UTF-8'); |
||
57 | |||
58 | //L'anim TICE
|
||
59 | $odf->setVars('atice_prenom', $datapost['ATICE_FIRSTNAME'], true, 'UTF-8'); |
||
60 | $odf->setVars('atice_nom', $datapost['ATICE_LASTNAME'], true, 'UTF-8'); |
||
61 | $odf->setVars('atice_email', $datapost['ATICE_EMAIL'], true, 'UTF-8'); |
||
62 | |||
63 | //Le revendeur
|
||
64 | $odf->setVars('rvd_code', $datapost['RCODE'], true, 'UTF-8'); |
||
65 | $odf->setVars('rvd_nom', $datapost['RNAME'], true, 'UTF-8'); |
||
66 | $odf->setVars('rvd_tel', $datapost['RTEL'], true, 'UTF-8'); |
||
67 | $odf->setVars('rvd_email', $datapost['REMAIL'], true, 'UTF-8'); |
||
68 | $odf->setVars('rvd_adresse', $datapost['RADDRESS'], true, 'UTF-8'); |
||
69 | $odf->setVars('rvd_cp', $datapost['RCP'], true, 'UTF-8'); |
||
70 | $odf->setVars('rvd_ville', $datapost['RVILLE'], true, 'UTF-8'); |
||
71 | |||
72 | //On créé un fichier local pour archive ...
|
||
73 | $fichier="archives/" . date("Y-m-d") . "-epack-register-" . $code . ".odp"; |
||
74 | $fichier_pdf="archives/" . date("Y-m-d") . "-epack-register-" . $code . ".pdf"; |
||
75 | |||
76 | $odf->saveToDisk($fichier); |
||
77 | $t = exec("unoconv --server localhost --port 2002 -f pdf " . $fichier); |
||
78 | |||
79 | //Ensuite il faut l'envoyer par email ...
|
||
80 | $txtmail = "Bonjour, |
||
81 | vous venez d'enregistrer un ePack d'installation AbulÉdu et nous vous en remercions.
|
||
82 |
|
||
83 | Vous trouverez ci-joint le document récapitulatif de votre enregistrement.
|
||
84 |
|
||
85 | --
|
||
86 | RyXéo SARL
|
||
87 | contact@ryxeo.com
|
||
88 | Tel: 05 35 54 01 18";
|
||
89 | $crlf = "\n"; |
||
90 | $hdrs = array( |
||
91 | 'From' => 'contact@ryxeo.com', |
||
92 | 'Subject' => mb_encode_mimeheader("[AbulEdu] Fiche d'installation " . $datapost['INAME']), |
||
93 | af8e09aa | Eric Seigne | 'BCC' => 'contact@ryxeo.com, supportteam@ryxeo.com' |
94 | abd6eaaa | Eric Seigne | ); |
95 | $mime = new Mail_mime($crlf); |
||
96 | $mime->setTXTBody($txtmail); |
||
97 | $mime->addAttachment($fichier_pdf, mime_content_type($fichier_pdf)); |
||
98 | b069f62c | root | $mime->addAttachment($fichier, mime_content_type($fichier)); |
99 | abd6eaaa | Eric Seigne | $body = $mime->get(array('text_charset' => 'utf-8')); |
100 | $hdrs = $mime->headers($hdrs); |
||
101 | $mail =& Mail::factory('mail'); |
||
102 | af8e09aa | Eric Seigne | |
103 | if(trim($datapost['REMAIL']) == "") { |
||
104 | if(trim($login_email) != "") { |
||
105 | $mail->send($login_email, $hdrs, $body); |
||
106 | } |
||
107 | else {
|
||
108 | //On cherche le mail associe a ce pack ?
|
||
109 | $mail->send("contact@ryxeo.com", $hdrs, $body); |
||
110 | } |
||
111 | } |
||
112 | else {
|
||
113 | $mail->send($datapost['REMAIL'], $hdrs, $body); |
||
114 | } |
||
115 | abd6eaaa | Eric Seigne | } |
116 | 6fd1e9d9 | Eric Seigne | |
117 | function send_mail_installation($pass,$code,$datapost) { |
||
118 | $mail_content = " |
||
119 |
|
||
120 | Bonjour,
|
||
121 |
|
||
122 | un nouveau serveur vient d'être inséré dans AbulÉdu.NET:
|
||
123 |
|
||
124 | Référence du ePack AbulÉdu:
|
||
125 | - $pass
|
||
126 | - $code
|
||
127 |
|
||
128 | Site de l'installation:
|
||
129 | - Nom: " . addslashes($datapost['INAME']) . " |
||
130 | - Adresse: " . addslashes($datapost['IADDRESS0'] . " " . $datapost['IADDRESS1'] ) . " |
||
131 | - Code postal: " . addslashes($datapost['IPOSTALCODE']) . " |
||
132 | - Ville: " . addslashes($datapost['ICITY']) . " |
||
133 | - Pays: " . addslashes($datapost['ICOUNTRY']) . " |
||
134 | - Téléphone: " . addslashes($datapost['ITEL']) . " |
||
135 | - Adresse email: " . addslashes($datapost['IEMAIL']) . " |
||
136 |
|
||
137 | Serveur:
|
||
138 | - Marque ou modèle: " . $datapost['ISRV'] . " |
||
139 | - Numéro de série: " . $datapost['ISERIAL'] . " |
||
140 | - Processeur: " . $datapost['CPU'] . " |
||
141 | - Mémoire vive: " . $datapost['RAM'] . " |
||
142 | - Disque dur 1: " . $datapost['HDD0'] . " |
||
143 | - Disque dur 2: " . $datapost['HDD1'] . " |
||
144 | - Carte réseau 1: " . $datapost['MAC0'] . " |
||
145 | - Carte réseau 2: " . $datapost['MAC1'] . " |
||
146 | - Date d'installation: " . $datapost['IDATE'] . " |
||
147 |
|
||
148 | Mots de passe:
|
||
149 | - root: " . $datapost['IROOT'] . " |
||
150 | - abuladmin: " . $datapost['IABE'] . " |
||
151 |
|
||
152 | Installateur:
|
||
153 | - Société: " . $datapost['RCODE'] . " |
||
154 | abd6eaaa | Eric Seigne | - Adresse: " . $datapost['RADDRESS'] . " |
155 | - Ville: " . $datapost['RCP'] . " " . $datapost['RVILLE'] . " |
||
156 | 6fd1e9d9 | Eric Seigne | - Nom: " . $datapost['RNAME'] . " |
157 | - Téléphone: " . $datapost['RTEL'] . " |
||
158 | - Email: " . $datapost['REMAIL'] . " |
||
159 |
|
||
160 | Compte utilisateur:
|
||
161 | - Nom: " . $datapost['ADM_LASTNAME'] . " |
||
162 | - Prénom: " . $datapost['ADM_FIRSTNAME'] . " |
||
163 | - Email: " . $datapost['ADM_EMAIL'] . " |
||
164 |
|
||
165 | Compte personne ressource:
|
||
166 | - Nom: " . $datapost['PR_LASTNAME'] . " |
||
167 | - Prénom: " . $datapost['PR_FIRSTNAME'] . " |
||
168 | - Email: " . $datapost['PR_EMAIL'] . " |
||
169 |
|
||
170 | Compte ATICE:
|
||
171 | - Nom: " . $datapost['ATICE_LASTNAME'] . " |
||
172 | - Prénom: " . $datapost['ATICE_FIRSTNAME'] . " |
||
173 | - Email: " . $datapost['ATICE_EMAIL'] . " |
||
174 |
|
||
175 | Commentaires:
|
||
176 | " . $datapost["ICOMMENT"] . " |
||
177 |
|
||
178 | --
|
||
179 | abuledu.net est un service de RyXéo SARL, société éditrice d'AbulÉdu
|
||
180 |
|
||
181 | ";
|
||
182 | abd6eaaa | Eric Seigne | |
183 | f8c1248f | Eric Seigne | if(stripos($code, "-TESTS-")) { |
184 | ryxeo_mail("anet@ryxeo.com",$mail_content,"contact@ryxeo.com","[epack de test] Nouveau serveur dans la base abuledu.net"); |
||
185 | b915f380 | Eric Seigne | make_conffiles($datapost['MAC0'],$pass,$code); |
186 | abd6eaaa | Eric Seigne | } |
187 | else {
|
||
188 | ryxeo_mail("anet@ryxeo.com",$mail_content,"contact@ryxeo.com","Nouveau serveur dans la base abuledu.net"); |
||
189 | } |
||
190 | 6fd1e9d9 | Eric Seigne | } |
191 | |||
192 | 1c14bcc4 | Eric Seigne | //Verifie si les donnees qu'on a en entree sont correctes sinon on saute ... direction webadmin/installation
|
193 | function verification_data() { |
||
194 | global $datapost; |
||
195 | global $message; |
||
196 | $error = ""; |
||
197 | b915f380 | Eric Seigne | if(trim(strtolower($datapost['MAC0'])) == "") // || trim(strtolower($datapost['MAC1'])) == "" ) |
198 | 1c14bcc4 | Eric Seigne | $error .= "<li>Il manque une carte réseau dans ce serveur !</li>"; |
199 | if(trim($datapost['INAME']) == "") |
||
200 | $error .= "<li>Erreur sur le nom de l'installation</li>"; |
||
201 | if(trim($datapost['IADDRESS0']) == "") |
||
202 | $error .= "<li>Adresse de l'installation incorrecte</li>"; |
||
203 | if(trim($datapost['IPOSTALCODE']) == "") |
||
204 | $error .= "<li>Code postal incorrect</li>"; |
||
205 | if(trim($datapost['ICITY']) == "") |
||
206 | $error .= "<li>Nom de ville incorrect</li>"; |
||
207 | if(trim($datapost['ICOUNTRY']) == "") |
||
208 | $error .= "<li>Nom du pays incorrect</li>"; |
||
209 | if(trim($datapost['ITEL']) == "") |
||
210 | $error .= "<li>Numéro de téléphone incorect</li>"; |
||
211 | if(trim($datapost['ADM_LASTNAME']) == "") |
||
212 | $error .= "<li>Nom du contact administratif incomplet</li>"; |
||
213 | if(trim($datapost['ADM_FIRSTNAME'])== "") |
||
214 | $error .= "<li>Prénom du contact administratif incomplet</li>"; |
||
215 | if(strpos($datapost['IEMAIL'],"@") == FALSE) |
||
216 | $error .= "<li>Adresse email de l'école incorrecte</li>"; |
||
217 | if(strpos($datapost['ADM_EMAIL'],"@") == FALSE) |
||
218 | $error .= "<li>Adresse email du responsable administratif incorrecte</li>"; |
||
219 | |||
220 | if($error != "") { |
||
221 | $message .= "<ul>"; |
||
222 | $message .= $error; |
||
223 | $message .= "</ul>"; |
||
224 | return false; |
||
225 | } |
||
226 | else
|
||
227 | return true; |
||
228 | |||
229 | } |
||
230 | |||
231 | b915f380 | Eric Seigne | //création des fichiers de conf sur ce nouve<au serveur
|
232 | 1c14bcc4 | Eric Seigne | //ou restauration des fichiers de conf (si réinstallation)
|
233 | function make_conffiles($login,$pass,$code) { |
||
234 | global $commande; |
||
235 | $codecrypt = md5($pass); |
||
236 | 84a3aa0e | Eric Seigne | |
237 | //Si c'est un serveur de tests on ne cree surtout pas le fichier gdipc pour eviter que apt essaye
|
||
238 | //de passer en mode authentifie, on demandera donc le login/pass rvd a chaque upgrade
|
||
239 | if(stripos($code, "-TESTS-")) { |
||
240 | $commande .= ""; |
||
241 | } |
||
242 | else {
|
||
243 | $commande .= " echo \"" . $login . ";dip.abuledu.net;http://dip.abuledu.net/gnudip/cgi-bin/gdipupdt.cgi;" . $codecrypt . ";/home/abecmd/.GnuDIP2.cache." . $login . ".dip.abuledu.net;0;2073600\" > ~abecmd/.GnuDIP2 |
||
244 | 1c14bcc4 | Eric Seigne | chmod 600 ~abecmd/.GnuDIP2
|
245 | chown abecmd:admin ~abecmd/.GnuDIP2
|
||
246 | 84a3aa0e | Eric Seigne | su - abecmd gdipc\n";
|
247 | } |
||
248 | |||
249 | $commande .= " mkdir ~abecmd/.ssh || true |
||
250 | 1c14bcc4 | Eric Seigne | echo \"ssh-dss AAAAB3NzaC1kc3MAAACBAPM3DKuDXuSsQgPeBNO/jBEAd28smHqYVAODRwshfI04/rFvwh/A+7UZ2H/QnZOn6XLS/3R4yPp/QdGKEJ0BCHDd2fLIuS6ZLDHoHdQRBFzEAXP1SE1Yyp9c1pKnWeke6oK6196yKpE2aWBRv9kma+KoPhz7mpt6KHISow+yYV/PAAAAFQDFCotxKtxherzuwzVbeXmiOGQ3EwAAAIEAq+KXzJUt13h5QvM7u0O3mbDGD6YY9avMYqFk8StJ4DoFpSfeiwvNynoDsAE2qLTje7hbs+UO4Ns1lCLhh4R4T9wdLodTRVfizvqjZhmhOGfTHUjX9qi+dTs7c0mtqZz89ZZSqJsnMb9I1Ifj0H++MOswa7qp1cFxzUYtlew128QAAACAXve21Gn+gD7GXhvLIMq7bq6/ECjcjoBQcpLF72Z3tAsd0i0Scv1eydsUiee47pr3o4fJToQAr3iFQX6zWnDaw4htg3cZAMzfuvXxuWBcDoQ2qjYAk1A/FoJM7z5pPZXnWQZ+Vq+HfsW8W7EHztVgoZ/Xj/10webHjcL8CzFGWU4= remoteabecmd@Timide
|
251 | ssh-dss AAAAB3NzaC1kc3MAAACBAIyAzv1X8Hy8r8QiJAmhlDs9INd0jCpYNk5OxBDYA1/qdmKVqVMwKACvZg8xigRBg4e5PMsgpGQf9OxHTlhIiqAjwxmi7tHAy1t1fHuqDCZmqpQG5banOPvr4R5w4q47jKAJNqRsofgZACQKo8KkSHxY5VWZNx5bOfZYdEcWcNqpAAAAFQCXElvdvY+/aILI5a1z4fKRybA7GQAAAIB+5v/foiMKyZ+JEocToPIj2fP4mH7o8xnA1T8HKUGOiutxT/TWT4OnUMmquA/XVdzOyJ/tEeznfUDvlJZzKtFoW75ftQ8Or0AJj68jGQQ3wxQW5TXKuOCoo4vdf0ZQ+ASbzY1ECdxiQEB5kWusWbpes/eyTzDzjpUjMfR2JS5+rAAAAIAksQfdasobfpGuqLIvHBpgSFyas9J6EguBQVauNyLy7IE/WmAN1zgbYvBVU7KY3WUr5pgum9GcExCfnGH/qW7zR7M5zbZdOwq2W4AphXibkf+YbB2q1BouigbUzCiA54wa6XArtHsx0PpzyToHjAplnI4O5DhJ1SQNHClLbfA9Gw== erics@hurlevent
|
||
252 | \" > ~abecmd/.ssh/authorized_keys
|
||
253 | chmod 700 ~abecmd/.ssh -R
|
||
254 | chown abecmd:admin ~abecmd/.ssh -R
|
||
255 | b915f380 | Eric Seigne | adduser abecmd admin || true
|
256 | 1c14bcc4 | Eric Seigne | cd ~abecmd
|
257 | wget apt.ryxeo.com/ryxeo/bashrc -O .bashrc
|
||
258 | chown abecmd .bashrc
|
||
259 | ";
|
||
260 | |||
261 | //Et maintenant on sauvegarde qqpart le code/pass du pack
|
||
262 | $commande .= " |
||
263 | echo \"" . $code . ":" . $pass . "\" > /etc/abuledu/epack |
||
264 | b915f380 | Eric Seigne | chown aesd:www-data /etc/abuledu/epack || true
|
265 | chmod 640 /etc/abuledu/epack || true
|
||
266 | sed -i -e \"/.*EPACK.*/D\" /etc/abuledu/rvd || true
|
||
267 | echo RVD_EPACK_CODE=\\\"$code\\\" >> /etc/abuledu/rvd
|
||
268 | 1c14bcc4 | Eric Seigne | ";
|
269 | |||
270 | //L'identification du revendeur ... a améliorer
|
||
271 | $commande .= make_rvd_conffile();
|
||
272 | |||
273 | //Il faudrait egalement faire la base pour OCS-NG et les remontees automatiques ... on utilisera le code du epack
|
||
274 | } |
||
275 | |||
276 | function make_rvd_conffile() { |
||
277 | global $DB; |
||
278 | //Securisation de l'identification du revendeur ... a améliorer
|
||
279 | $commande .= " |
||
280 | chown aesd /etc/abuledu/rvd
|
||
281 | chmod 400 /etc/abuledu/rvd
|
||
282 | ";
|
||
283 | |||
284 | } |
||
285 | |||
286 | function add_user_and_update_link($usermail,$identity,$userlastname,$userfirstname,$tag="") { |
||
287 | global $DB; |
||
288 | global $message; |
||
289 | global $send_mail; |
||
290 | |||
291 | if(trim($usermail) == "") { |
||
292 | $message .= "<li><font color=\"red\">ERROR ($tag)</font> compte utilisateur sans adresse email ! $userlastname :: $userfirstname</li>\n"; |
||
293 | return;
|
||
294 | } |
||
295 | |||
296 | $query = "SELECT * from glpi_users WHERE email='$usermail'"; |
||
297 | $result = $DB->query($query); |
||
298 | e213dd82 | root | $debug .= "<p>nb ; " . $DB->numrows($result) . " req : $query</p>"; |
299 | 1c14bcc4 | Eric Seigne | if($DB->numrows($result)>0) { |
300 | $data = $DB->fetch_assoc($result); |
||
301 | $iduser = $data['ID']; |
||
302 | //existe dejà on fait juste le lien s'il n'existe pas déjà
|
||
303 | $query2 = "SELECT * FROM glpi_users_profiles WHERE FK_users='$iduser' AND FK_entities='$identity'"; |
||
304 | e213dd82 | root | //$debug .= "$query2";
|
305 | 1c14bcc4 | Eric Seigne | $result2 = $DB->query($query2); |
306 | if($DB->numrows($result2)<=0) { |
||
307 | cb915e0f | Eric Seigne | //pour eviter qu'un utilisateur se retrouve dans l'entite racine ...
|
308 | if(trim($identity) != 0) { |
||
309 | $query3 = "INSERT INTO glpi_users_profiles(FK_users,FK_entities,FK_profiles,recursive,dynamic) VALUES('$iduser','$identity',1,0,1)"; |
||
310 | $result3 = $DB->query($query3); |
||
311 | $send_mail = 1; |
||
312 | if($result3) |
||
313 | $message .= "<li>Attribution des droits de l'utilisateur $usermail sur le serveur: <font color=\"green\">OK</font></li>\n"; |
||
314 | else {
|
||
315 | $message .= "<li>Attribution des droits de l'utilisateur $usermail sur le serveur: <font color=\"red\">ERROR</font></li>\n"; |
||
316 | } |
||
317 | } |
||
318 | 1c14bcc4 | Eric Seigne | else {
|
319 | b069f62c | root | $message .= "<li>Tentative de lien avec l'entité racine($identity) refusée pour $usermail: <font color=\"red\">ERROR</font></li>\n"; |
320 | d485029b | root | //$message .= "<li>$query2</li>\n";
|
321 | 1c14bcc4 | Eric Seigne | } |
322 | } |
||
323 | //Sinon c'est que tout est déjà fait !
|
||
324 | } |
||
325 | //Sinon c'est que l'utilisateur n'existe pas encore dans la base
|
||
326 | else {
|
||
327 | //Insérer l'utilisateur ... et appel sur la même fonction qui cette fois ci fera le reste :)
|
||
328 | $query2 = "INSERT INTO glpi_users(name,email,realname,firstname,FK_profiles,FK_entities,auth_method) VALUES( |
||
329 | '$usermail',
|
||
330 | '$usermail',
|
||
331 | '$userlastname',
|
||
332 | '$userfirstname',
|
||
333 | '0',
|
||
334 | '$identity',
|
||
335 | '1'
|
||
336 | )";
|
||
337 | $result2 = $DB->query($query2); |
||
338 | $send_mail = 1; |
||
339 | if($result2) { |
||
340 | $message .= "<li>Création du compte utilisateur $usermail : <font color=\"green\">OK</font></li>\n"; |
||
341 | add_user_and_update_link($usermail,$identity,$userlastname,$userrfirstname,$tag); |
||
342 | } |
||
343 | else {
|
||
344 | $message .= "<li>Création du compte utilisateur $usermail : <font color=\"red\">ERROR</font></li>\n"; |
||
345 | } |
||
346 | } |
||
347 | } |
||
348 | |||
349 | //Vite une session
|
||
350 | session_start(); |
||
351 | if(trim($_GET['reset']) != "") { |
||
352 | // Finalement, on détruit la session.
|
||
353 | session_destroy(); |
||
354 | header('Location: http://abuledu.net/epack/register/'); |
||
355 | } |
||
356 | //print_r($_SESSION);
|
||
357 | //recupration des variables de l'url
|
||
358 | $g_http_request = $_SERVER['REQUEST_URI']; |
||
359 | e213dd82 | root | |
360 | 1c14bcc4 | Eric Seigne | if($_SESSION['epack_session'] > 1) { |
361 | $pass = strtoupper($_SESSION['epack_pass']); |
||
362 | $code = strtoupper($_SESSION['epack_code']); |
||
363 | if(isset($_POST['login_email'])) { |
||
364 | $login_email = $_POST['login_email']; |
||
365 | $login_pass = $_POST['login_pass']; |
||
366 | } |
||
367 | if(isset($_SESSION['login_email'])) { |
||
368 | $login_email = $_SESSION['login_email']; |
||
369 | $login_pass = $_SESSION['login_pass']; |
||
370 | } |
||
371 | } |
||
372 | else {
|
||
373 | e213dd82 | root | $debug .= "Pas de session\n"; |
374 | 1c14bcc4 | Eric Seigne | //Si on est sur un formulaire POST (on casse la limite de la taille de la requete GET)
|
375 | if(isset($_POST["pass"])) { |
||
376 | e213dd82 | root | $debug .= "Passage en POST\n"; |
377 | |||
378 | 1c14bcc4 | Eric Seigne | $pass = $_POST["pass"]; |
379 | $code = strtoupper($_POST["code"]); |
||
380 | $datapost = array(); |
||
381 | e213dd82 | root | |
382 | $debug .= "<p>Req::" . $_SERVER['REQUEST_URI'] . "</p>\n"; |
||
383 | |||
384 | 1c14bcc4 | Eric Seigne | foreach($_POST as $key=>$value) { |
385 | $datapost[$key]=$value; |
||
386 | e213dd82 | root | $debug .= "<p>" . $key . " -> " . $value . "</p>\n"; |
387 | 1c14bcc4 | Eric Seigne | } |
388 | } |
||
389 | else {
|
||
390 | ereg(".*pass=(.*).code=(.*).data=(.*)",$_SERVER['REQUEST_URI'],$regs); |
||
391 | $pass = addslashes($regs[1]); |
||
392 | $code = strtoupper(addslashes($regs[2])); |
||
393 | $keyvalue_list=explode("&",base64_decode($regs[3])); |
||
394 | $datapost = array(); |
||
395 | e213dd82 | root | |
396 | $debug .= "<p>Req::" . $_SERVER['REQUEST_URI'] . "</p>\n"; |
||
397 | 1c14bcc4 | Eric Seigne | foreach($keyvalue_list as $key=>$value) { |
398 | // Explode each individual key/value into an array
|
||
399 | $keyvalue=explode("=",$value); |
||
400 | // Make sure we have a "key=value" array
|
||
401 | if(count($keyvalue)==2) { |
||
402 | $datapost[$keyvalue[0]]=$keyvalue[1]; |
||
403 | e213dd82 | root | $debug .= "<p>" . $keyvalue[0] . " -> " . $keyvalue[1] . "</p>\n"; |
404 | 1c14bcc4 | Eric Seigne | } |
405 | else {
|
||
406 | e213dd82 | root | $debug .= "<p>XXX:" . $value . "</p>\n"; |
407 | 1c14bcc4 | Eric Seigne | } |
408 | } |
||
409 | } |
||
410 | |||
411 | //Ou du POST
|
||
412 | if(trim($pass) == "" || trim($code) == "") { |
||
413 | $pass = addslashes($_POST['pass']); |
||
414 | $code = addslashes(strtoupper($_POST['code'])); |
||
415 | } |
||
416 | } |
||
417 | e213dd82 | root | |
418 | 1c14bcc4 | Eric Seigne | $_SERVER['REQUEST_URI'] = ""; |
419 | $_SERVER['HTTP_REFERER'] = ""; |
||
420 | e213dd82 | root | |
421 | 1c14bcc4 | Eric Seigne | define('GLPI_ROOT', '..'); |
422 | include (GLPI_ROOT . "/inc/includes.php"); |
||
423 | |||
424 | include ("ryxeo.php"); |
||
425 | abd6eaaa | Eric Seigne | include('Mail.php'); |
426 | include('Mail/mime.php'); |
||
427 | 1c14bcc4 | Eric Seigne | |
428 | 84a3aa0e | Eric Seigne | //Si epack ryxeo de tests
|
429 | if(stripos($code, "RYXEO-TESTS-")) { |
||
430 | abd6eaaa | Eric Seigne | if(is_array($datapost)) { |
431 | $k = array_keys($datapost); |
||
432 | for($i = 0; $i < count($k); $i++) { |
||
433 | $key = $k[$i]; |
||
434 | $debug .= $key . "=" . $datapost[$key] . "\n"; |
||
435 | } |
||
436 | 1c14bcc4 | Eric Seigne | } |
437 | ea4a2a64 | Eric Seigne | } |
438 | 84a3aa0e | Eric Seigne | if(isset($datapost["MINIWEBADMIN"]) && stripos($code, "-TESTS-")) { |
439 | ea4a2a64 | Eric Seigne | $message .= "<p><h2>Vous pouvez maintenant passer à l'étape suivante: <a href=\"/maj/\">la 1ere mise à jour de votre serveur.</a></h2></p>\n"; |
440 | //le flag qui indique a miniwebadmin que le epack est enregistre
|
||
441 | $commande .= "\n touch /tmp/epack.ok \n"; |
||
442 | } |
||
443 | abd6eaaa | Eric Seigne | |
444 | e213dd82 | root | /*
|
445 | if(trim($debug) != "" ) {
|
||
446 | ea4a2a64 | Eric Seigne | $message .= "<pre>
|
447 | e213dd82 | root | $debug
|
448 | </pre>";
|
||
449 | }
|
||
450 | */
|
||
451 | |||
452 | $debug .= "<p>Du cote abuledu.net ... $g_http_request</p>\n7"; |
||
453 | ea4a2a64 | Eric Seigne | |
454 | f8c1248f | Eric Seigne | //On ne fait pas tout le bazaaar, on teste / valide la procedure uniquement
|
455 | if(stripos($code, "-TESTS-")) { |
||
456 | make_pdf($pass,$code,$datapost); |
||
457 | send_mail_installation($pass,$code,$datapost); |
||
458 | } |
||
459 | ea4a2a64 | Eric Seigne | //print_r($_SERVER);
|
460 | //On ne fait pas tout le bazaaar, on teste / valide la procedure uniquement
|
||
461 | f8c1248f | Eric Seigne | if(stripos($code, "-TESTS-")) { |
462 | 84a3aa0e | Eric Seigne | $object = array(); |
463 | $object['message'] = "<h1>Enregistrement de votre serveur avec un ePack</h1>\n"; |
||
464 | $object['message'] .= $message; |
||
465 | $object['command'] = $commande; |
||
466 | |||
467 | print serialize($object); |
||
468 | 6fd1e9d9 | Eric Seigne | return;
|
469 | ea4a2a64 | Eric Seigne | } |
470 | 1c14bcc4 | Eric Seigne | |
471 | //print "<pre>";
|
||
472 | //print_r($datapost);
|
||
473 | //$message .= implode("::",$datapost);
|
||
474 | //print "</pre>";
|
||
475 | //reset ...
|
||
476 | //print_r($_SESSION);
|
||
477 | //unset($_SESSION['epack_session']);
|
||
478 | if(trim($pass) != "" && trim($code) != "") { |
||
479 | $query = "SELECT * FROM glpi_plugin_anet_epacks |
||
480 | LEFT JOIN glpi_entities AS g ON FK_client=g.ID
|
||
481 | WHERE code='$code' AND password='$pass'";
|
||
482 | $result = $DB->query($query); |
||
483 | e213dd82 | root | //$message = "$query";
|
484 | 1c14bcc4 | Eric Seigne | $mac0 = trim(strtolower($datapost['MAC0'])); |
485 | $mac1 = trim(strtolower($datapost['MAC1'])); |
||
486 | //$data=$DB->fetch_assoc($result);
|
||
487 | //$nbresultat = $DB->numrows($result);
|
||
488 | e213dd82 | root | //print_r($data);
|
489 | //exit;
|
||
490 | 1c14bcc4 | Eric Seigne | if($DB->numrows($result)>0) { |
491 | $data=$DB->fetch_assoc($result); |
||
492 | |||
493 | //$message .= "Eric ... " . $mac0 . ": $code : $mac1";
|
||
494 | if( ! verification_data() ) {
|
||
495 | $message .= "<p><font color=\"red\">Erreur, il manque des informations ou certaines informations ne sont pas correctes sur la <a href=\"/installation/\">fiche d'identité du serveur</a>. Merci de les corriger tout de suite et de repasser ensuite sur cette page !!!</font></p>\n"; |
||
496 | } |
||
497 | //pack deja attribué à un serveur ?
|
||
498 | else if($data['FK_serveur'] > 0) { |
||
499 | af8e09aa | Eric Seigne | // make_conffiles($datapost['MAC0'],$pass,$code);
|
500 | 1c14bcc4 | Eric Seigne | if( strlen($mac0) == 12 && strlen($mac1) == 12) { |
501 | //Petite vérification, si c'est le même serveur qu'on a réinstallé x fois on laisse faire
|
||
502 | $query2 = "SELECT * FROM glpi_computers WHERE os_license_number LIKE '" . $mac0 . "%' OR os_license_number LIKE '" . $mac1 . "%' "; |
||
503 | $result2 = $DB->query($query2); |
||
504 | $data2=$DB->fetch_assoc($result2); |
||
505 | //Ce pack a été utilisé pour ce serveur ... ok
|
||
506 | if($data2['ID'] == $data['FK_serveur']) { |
||
507 | $nbu = $data['nbused']; |
||
508 | make_conffiles($datapost['MAC0'],$pass,$code); |
||
509 | |||
510 | $message .= "<p>Ce pack a déjà été utilisé $nbu fois pour ce serveur. Si vous avez des difficultés pour utiliser ou configurer AbulÉdu, prennez contact avec la communauté des utilisateurs <a href=\"http://forum.abuledu.org\">sur les forums</a> ou par courriel avec la <a href=\"mailto:contact@ryxeo.com\">société RyXéo</a>, éditrice d'AbulÉdu.</p>\n"; |
||
511 | $message .= "<h4>Rappel des informations concernant ce serveur: </h4>"; |
||
512 | $message .= "<ul> |
||
513 | <li>Nom: " . $data2['name'] . "</li> |
||
514 | <li>Commentaires: " . $data2['comments'] . "</li> |
||
515 | </ul>\n";
|
||
516 | $message .= "<p>Merci d'avoir enregistré ce serveur. Pour toute demande de modification, veuillez utiliser votre compte abuledu.net ou prendre <a href=\"mailto:contact@ryxeo.com\">contact avec RyXéo</a></p>"; |
||
517 | |||
518 | d6c34dc8 | Eric Seigne | if(isset($datapost["MINIWEBADMIN"])) { |
519 | 6fd1e9d9 | Eric Seigne | $message .= "<p>Vous pouvez maintenant passer à l'étape suivante: <a href=\"/maj/\">la 1ere mise à jour de votre serveur.</a></p>\n"; |
520 | d6c34dc8 | Eric Seigne | //le flag qui indique a miniwebadmin que le epack est enregistre
|
521 | $commande .= "\n touch /tmp/epack.ok \n"; |
||
522 | } |
||
523 | 1c14bcc4 | Eric Seigne | //On incremente le compteur qui permettra de detecter les serveur tres souvent reinstalles
|
524 | $nbu = $data['nbused'] + 1; |
||
525 | $query3 = "UPDATE glpi_plugin_anet_epacks SET nbused='$nbu' WHERE code='$code' AND password='$pass'"; |
||
526 | $result3 = $DB->query($query3); |
||
527 | |||
528 | //On update les liens etc. (si on a change les comptes utilisateurs par ex.)
|
||
529 | //TODO
|
||
530 | $query1 = "SELECT * FROM glpi_entities WHERE name='" . addslashes($datapost['INAME']) . "' AND parentID='" . $data['FK_client'] . "'"; |
||
531 | $result1 = $DB->query($query1); |
||
532 | if($DB->numrows($result1) > 0) { |
||
533 | //L'entité existe déjà ...
|
||
534 | $data1 = $DB->fetch_assoc($result1); |
||
535 | $identityenduser = $data1['ID']; |
||
536 | } |
||
537 | b069f62c | root | else {
|
538 | //$message .= "<p>Erreur : $query1</p>";
|
||
539 | } |
||
540 | d485029b | root | //$message .= "<li>Entity: $query1</li>\n";
|
541 | 1c14bcc4 | Eric Seigne | add_user_and_update_link($datapost['IEMAIL'], $identityenduser,$datapost['INAME'],$datapost['ICITY'],"Installation"); |
542 | add_user_and_update_link($datapost['ADM_EMAIL'], $identityenduser,$datapost['ADM_LASTNAME'],$datapost['ADM_FIRSTNAME'],"Directrice ou directeur"); |
||
543 | add_user_and_update_link($datapost['PR_EMAIL'], $identityenduser,$datapost['PR_LASTNAME'],$datapost['PR_FIRSTNAME'],"Autre contact"); |
||
544 | add_user_and_update_link($datapost['ATICE_EMAIL'], $identityenduser,$datapost['ATICE_LASTNAME'],$datapost['ATICE_FIRSTNAME'],"Animateur TICE"); |
||
545 | |||
546 | make_conffiles($datapost['MAC0'],$pass,$code); |
||
547 | |||
548 | |||
549 | } |
||
550 | //Sinon, c'est louche, on informe ryxeo et on avertis l'utilisateur
|
||
551 | else {
|
||
552 | $message .= "<p>Attention, Ce pack a déjà été attribué à un serveur !</p>\n"; |
||
553 | $message .= "<p>Les packs sont à usage unique, merci d'acheter un nouveau pack pour ce serveur ou <a href=\"mailto:contact@ryxeo.com\">contactez-nous</a> si vous pensez qu'il s'agit d'une erreur.</p>\n"; |
||
554 | |||
555 | $mail_content = " |
||
556 | Bonjour,
|
||
557 | le pack $pass :: $code vient d'être utilisé pour enregistrer un serveur alors que ce pack a déjà
|
||
558 | été utilisé. Merci de vérifier s'il ne s'agit pas d'une tentative de réinstallation multiple ...
|
||
559 |
|
||
560 | Informations brutes récoltées:
|
||
561 |
|
||
562 | ";
|
||
563 | foreach ($datapost as $key => $value) { |
||
564 | $mail_content .= "$key -> $value\n"; |
||
565 | } |
||
566 | |||
567 | $mail_content .= " |
||
568 |
|
||
569 | --
|
||
570 | abuledu.net est un service de RyXéo SARL, société éditrice d'AbulÉdu
|
||
571 |
|
||
572 | ";
|
||
573 | ryxeo_mail("anet@ryxeo.com",$mail_content,"contact@ryxeo.com","Pack déjà activé plusieurs fois !"); |
||
574 | } |
||
575 | } |
||
576 | } |
||
577 | //pack deja utilise ? si oui c'est qu'il a bien été activé
|
||
578 | else if($data['FK_activation'] > 0) { |
||
579 | $notes = "Données collectées lors de l'enregistrement du serveur le " . date("Y-m-d") . "\n\n"; |
||
580 | foreach ($datapost as $key => $value) { |
||
581 | $notes .= "$key = $value\n"; |
||
582 | } |
||
583 | //On créé l'entité de l'école dans l'entité du client qui est elle même dans l'entité du revendeur
|
||
584 | $query1 = "SELECT * FROM glpi_entities WHERE name='" . addslashes($datapost['INAME']) . "' AND parentID='" . $data['FK_client'] . "'"; |
||
585 | $result1 = $DB->query($query1); |
||
586 | if($DB->numrows($result1) > 0) { |
||
587 | //L'entité existe déjà ...
|
||
588 | $data1 = $DB->fetch_assoc($result1); |
||
589 | $identityenduser = $data1['ID']; |
||
590 | } |
||
591 | else {
|
||
592 | //L'entité n'existe pas, on l'ajoute
|
||
593 | $query1 = "INSERT INTO glpi_entities VALUES('','" . addslashes($datapost['INAME']) . "'," . $data['FK_client'] . ",'" . $data['completename'] . " > " . addslashes($datapost['INAME']) . "','',5)"; |
||
594 | $result1 = $DB->query($query1); |
||
595 | $send_mail = 1; |
||
596 | } |
||
597 | $query1 = "SELECT * from glpi_entities WHERE name='" . addslashes($datapost['INAME']) . "' AND parentID='" . $data['FK_client'] . "';"; |
||
598 | $result1 = $DB->query($query1); |
||
599 | $data1 = $DB->fetch_assoc($result1); |
||
600 | //Creation ok
|
||
601 | $identityenduser = $data1['ID']; |
||
602 | if($DB->numrows($result1) > 0) { |
||
603 | $query1 = "INSERT INTO glpi_entities_data VALUES('',$identityenduser,'" . |
||
604 | addslashes($datapost['IADDRESS0'] . " " . $datapost['IADDRESS1'] ) . "','" . |
||
605 | addslashes($datapost['IPOSTALCODE']) . "','" . |
||
606 | addslashes($datapost['ICITY']) . "','" . |
||
607 | "','" .
|
||
608 | addslashes($datapost['ICOUNTRY']) . "','" . |
||
609 | "','" .
|
||
610 | addslashes($datapost['ITEL']) . "','" . |
||
611 | "','" .
|
||
612 | addslashes($datapost['IEMAIL']) . "','" . |
||
613 | "','" .
|
||
614 | "','" .
|
||
615 | "');";
|
||
616 | $result1 = $DB->query($query1); |
||
617 | //print $query1;
|
||
618 | //print_r($data1);
|
||
619 | $message .= "<ul>\n"; |
||
620 | if($result1) |
||
621 | $message .= "<li>Création de l'école: <font color=\"green\">OK</font></li>\n"; |
||
622 | else {
|
||
623 | $message .= "<li>Création de l'école: <font color=\"red\">ERROR</font></li>\n"; |
||
624 | } |
||
625 | |||
626 | } |
||
627 | |||
628 | //Il faut inserer le serveur dans le compte du client final et faire le toutim
|
||
629 | $query2 = "INSERT INTO glpi_computers(FK_entities,name,date_mod,os_license_number,comments,notes,state) |
||
630 | VALUES(
|
||
631 | '" . $identityenduser . "', |
||
632 | '" . addslashes($datapost['INAME']) . "', |
||
633 | NOW(),
|
||
634 | '" . $mac0 . ".dip.abuledu.net', |
||
635 | '" . addslashes($datapost['ICOMMENT']) . "', |
||
636 | '" . addslashes($notes) . "', |
||
637 | '1'
|
||
638 | )";
|
||
639 | $result2 = $DB->query($query2); |
||
640 | $send_mail = 1; |
||
641 | |||
642 | $query2 = "SELECT * from glpi_computers WHERE name='" . addslashes($datapost['INAME']) . "' AND os_license_number='" . $mac0 . ".dip.abuledu.net';"; |
||
643 | // print "select $query2";
|
||
644 | $result2 = $DB->query($query2); |
||
645 | $data2 = $DB->fetch_assoc($result2); |
||
646 | // print_r($data2);
|
||
647 | //Creation ok
|
||
648 | $idserver = $data2['ID']; |
||
649 | if($DB->numrows($result2) > 0) { |
||
650 | $message .= "<li>Ajout du serveur sur AbulÉdu.net: <font color=\"green\">OK</font></li>\n"; |
||
651 | |||
652 | //On attribue le pack au serveur
|
||
653 | $nbu = $data['nbused'] + 1; |
||
654 | $query3 = "UPDATE glpi_plugin_anet_epacks SET FK_serveur='" . $idserver . "', FK_enduser='" . $identityenduser . "', nbused='$nbu' WHERE code='$code' AND password='$pass'"; |
||
655 | $result3 = $DB->query($query3); |
||
656 | |||
657 | |||
658 | $query3 = "INSERT INTO glpi_computer_device(specificity,device_type,FK_device,FK_computers) |
||
659 | VALUES('" . $datapost['CPU'] . "','2','2','$idserver'), |
||
660 | ('" . $datapost['RAM'] . "','3','2','$idserver'), |
||
661 | ('" . $datapost['HDD0'] . "','4','4','$idserver'),"; |
||
662 | if(trim($datapost['HDD1'])) |
||
663 | $query3 .= "('" . $datapost['HDD1'] . "','4','4','$idserver'),"; |
||
664 | $query3 .= "('" . $datapost['MAC0'] . "','5','2','$idserver'), |
||
665 | ('" . $datapost['MAC1'] . "','5','2','$idserver');"; |
||
666 | $result3 = $DB->query($query3); |
||
667 | $send_mail = 1; |
||
668 | if($result3) |
||
669 | $message .= "<li>Ajout des pièces détachées du serveur: <font color=\"green\">OK</font></li>\n"; |
||
670 | else
|
||
671 | $message .= "<li>Ajout des pièces détachées du serveur: <font color=\"red\">ERROR</font></li>\n"; |
||
672 | //Insertion des pièces détachées ok
|
||
673 | |||
674 | //Ajout des contacts liés à ce serveur ?
|
||
675 | add_user_and_update_link($datapost['IEMAIL'], $identityenduser,$datapost['INAME'],$datapost['ICITY'],"Installation"); |
||
676 | add_user_and_update_link($datapost['ADM_EMAIL'], $identityenduser,$datapost['ADM_LASTNAME'],$datapost['ADM_FIRSTNAME'],"Directrice ou directeur"); |
||
677 | add_user_and_update_link($datapost['PR_EMAIL'], $identityenduser,$datapost['PR_LASTNAME'],$datapost['PR_FIRSTNAME'],"Autre contact"); |
||
678 | add_user_and_update_link($datapost['ATICE_EMAIL'], $identityenduser,$datapost['ATICE_LASTNAME'],$datapost['ATICE_FIRSTNAME'],"Animateur TICE"); |
||
679 | |||
680 | //Création des fichiers de conf pour se rattacher a la maintenance (?) ... mais si pas de maintenance ?
|
||
681 | //On gerera ça sur les paiements des contrats associés
|
||
682 | make_conffiles($datapost['MAC0'],$pass,$code); |
||
683 | |||
684 | f8c1248f | Eric Seigne | //Mail d'information a ryxeo + pdf au rvendeur
|
685 | make_pdf($pass,$code,$datapost); |
||
686 | 6fd1e9d9 | Eric Seigne | send_mail_installation($pass,$code,$datapost); |
687 | f8c1248f | Eric Seigne | |
688 | af8e09aa | Eric Seigne | if(isset($datapost["MINIWEBADMIN"])) { |
689 | $message .= "</ul>\n<p>Vous pouvez maintenant passer à l'étape suivante: <a href=\"/maj/\">la 1ere mise à jour de votre serveur.</a></p>\n"; |
||
690 | //le flag qui indique a miniwebadmin que le epack est enregistre
|
||
691 | $commande .= "\n touch /tmp/epack.ok \n"; |
||
692 | } |
||
693 | else {
|
||
694 | $message .= "<li><font color=\"green\">Bravo</font> votre serveur est maintenant bien enregistré sur abuledu.net. Vous pouvez passer à l'étape de création automatique du <a href=\"recette.php\">cahier de recettes</a></li>\n"; |
||
695 | $message .= "</ul>\n"; |
||
696 | } |
||
697 | 1c14bcc4 | Eric Seigne | } |
698 | else
|
||
699 | $message .= "<li>Ajout du serveur sur anet: <font color=\"red\">ERROR</font></li>\n"; |
||
700 | } |
||
701 | else if ($data['activation_date'] == "0000-00-00") { |
||
702 | 6fd1e9d9 | Eric Seigne | $message .= "<p><font color=\"red\">Erreur, ce packs n'a pas été activé !!! Vous devez activer votre ePack tout de suite à l'adresse suivante, <a href=\"http://www.abuledu.net/epack/new\" target=\"_blank\">abuledu.net/epack/new</a> comme indiqué sur la fiche ePack.</font></p>\n"; |
703 | 1c14bcc4 | Eric Seigne | } |
704 | else {
|
||
705 | $message .= "<p><font color=\"red\">Erreur, ce pack a déjà été utilisé ou n'a pas encore été activé !!!</font></p>\n"; |
||
706 | } |
||
707 | } |
||
708 | else {
|
||
709 | $message .= "<p><font color=\"red\">Erreur de code ou de mot de passe epack !!!</font></p>\n"; |
||
710 | } |
||
711 | } |
||
712 | else {
|
||
713 | $message .= "<p><font color=\"red\">Erreur: code ou mot de passe epack invalide.</font></p>\n"; |
||
714 | } |
||
715 | |||
716 | $object = array(); |
||
717 | 84a3aa0e | Eric Seigne | if(trim($message) == "") |
718 | 1c14bcc4 | Eric Seigne | $message .= "<p><font color=\"red\">Erreur non prévue, merci de contacter RyXéo sans tarder...</font></p>"; |
719 | $object['message'] = "<h1>Enregistrement de votre serveur avec un ePack</h1>\n"; |
||
720 | $object['message'] .= $message; |
||
721 | $object['command'] = $commande; |
||
722 | |||
723 | //On touche le fichier pour forcer un update de gnudip et des accreditations ... uniquement si epack valide
|
||
724 | if($send_mail) { |
||
725 | @touch("/tmp/update-anet"); |
||
726 | @chmod("/tmp/update-anet",0666); |
||
727 | } |
||
728 | print serialize($object); |
||
729 | //print_r($_SERVER);
|
||
730 | |||
731 | ?> |