Rev 1387 | Rev 1452 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log
Rev | Author | Line No. | Line |
---|---|---|---|
1387 | richard | 1 | <?php |
1380 | richard | 2 | # Test présence de clé/modem |
3 | $exec_com=exec("lsusb | grep -i 067b | cut -d ' ' -f6 | cut -d ' ' -f1"); |
||
4 | $exec_com2=exec("lsusb | grep -i 12d1 | cut -d ' ' -f6 | cut -d ' ' -f1"); |
||
5 | |||
6 | //$exec_com2=exec("lsusb | grep -i d-link | cut -d ' ' -f7"); |
||
7 | |||
1349 | richard | 8 | $status_key="false"; |
9 | $script="/usr/local/bin/alcasar-sms.sh"; |
||
10 | |||
11 | #Define |
||
12 | $gammu_puk = ""; |
||
13 | $gammu_simfail = ""; |
||
14 | $gammu_simsecu = ""; |
||
15 | $gammu_writeerror = ""; |
||
16 | $gammu_timeout = ""; |
||
17 | $error_pin = ""; |
||
18 | $error_time_account = ""; |
||
19 | $error_nb_essais = ""; |
||
20 | $error_time_perm = ""; |
||
21 | $error_num_alcasar = ""; |
||
1416 | richard | 22 | $country_filter=""; |
1349 | richard | 23 | |
24 | # Choice of language |
||
25 | $Language = 'en'; |
||
26 | if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){ |
||
1380 | richard | 27 | $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); |
28 | $Language = strtolower(substr(chop($Langue[0]),0,2)); } |
||
1349 | richard | 29 | if($Language == 'fr'){ |
30 | $l_title = "Auto enregistrement (SMS)"; |
||
31 | $l_conf = "Configuration"; |
||
32 | $l_conf_actu = "Configuration actuelle"; |
||
33 | $l_pin = "Code PIN"; |
||
34 | $l_num_alcasar = "Le numero de téléphone de la clé 3G"; |
||
1380 | richard | 35 | $l_ban_temp = "Nombre d'essais avant le blocage"; |
1349 | richard | 36 | $l_time_account = "Durée pour une session créée"; |
1380 | richard | 37 | $l_time_perm = "Durée du blocage (en jours)"; |
1349 | richard | 38 | $l_status_gammu = "Etat du service"; |
39 | $l_start = "Démarrer"; |
||
40 | $l_status_device = "Status de votre périphérique"; |
||
1387 | richard | 41 | $l_key_diseable = "Aucun périphérique détecté"; |
1349 | richard | 42 | $l_key_enable = "Votre clé est connectée"; |
43 | $l_force_signal = "Force du signal"; |
||
44 | $l_imei_device = "IMEI du périphérique"; |
||
45 | $l_sms_received = "Nombre de SMS reçu"; |
||
46 | $l_stop = "Arrêter"; |
||
47 | $l_gammu_on="Gammu est lancé"; |
||
48 | $l_gammu_off="Gammu est arrêté"; |
||
49 | $l_edit = "Editer"; |
||
50 | $l_error_label_empty = "Le champ est vide"; |
||
51 | $l_error_label_num = "Ce n'est pas un PIN valide"; |
||
52 | $l_error_label_num2 = "Ce n'est pas un nombre"; |
||
1380 | richard | 53 | $l_error_label_num3 = "Le format n'est pas correct: +xxxYYYYYYYYY (xxx: code pays / YYYYYYYYY: numéro de téléphone)"; |
1387 | richard | 54 | $l_error_writefail = "Le service semble ne pas parvenir à discuter avec la clé (port ttyUSB0)."; |
1349 | richard | 55 | $l_error_timeoutfail = "Impossible de se connecter à la clé 3G. Timeout."; |
56 | $l_error_simfail = "Un problème au niveau de la carte SIM a été détecté. Est elle présente?"; |
||
57 | $l_error_simsecu_l = "Attention, lors du dernier démarrage, votre code PIN était erroné.<br> |
||
1380 | richard | 58 | La SIM doit être bloqué (code PUK). Consultez la documentation."; |
1349 | richard | 59 | $l_autorefresh = "Rafraichissement : 30 sec"; |
60 | $l_days = "jours "; |
||
61 | |||
62 | $l_num_block="Liste des numéros bloqués"; |
||
63 | $l_num_num="Numéro"; |
||
64 | $l_num_raison="Raison"; |
||
65 | $l_num_expiration="Date d'expiration"; |
||
66 | $l_num_action="Action"; |
||
67 | $l_num_exist="Un compte a été créé"; |
||
1416 | richard | 68 | $l_num_flood="Le nombre d'essais maximum a été dépassé"; |
1349 | richard | 69 | $l_num_unlock="Effacer"; |
1416 | richard | 70 | $l_country_enable="Activer"; |
71 | $l_country_disable="Désactiver"; |
||
1349 | richard | 72 | $l_service_status_img_ok="Démarré"; |
73 | $l_service_status_img_ko="Arrété"; |
||
1380 | richard | 74 | |
75 | $l_conf_name="Configuration : "; |
||
76 | $l_current_connect = "Connexion"; |
||
1349 | richard | 77 | |
1387 | richard | 78 | $l_tab_first = "premier"; |
79 | $l_tab_last = "dernier"; |
||
80 | $l_tab_next = "suivant"; |
||
81 | $l_tab_prev = "précédent"; |
||
82 | $l_tab_search = "Recherche :"; |
||
83 | $l_tab_pmenu = "Affiche la page _PAGE_ sur _PAGES_"; |
||
1416 | richard | 84 | $l_tab_info = "Montrer _MENU_ résultats par page"; |
1387 | richard | 85 | $l_tab_infoempty = "Aucun résultat"; |
1416 | richard | 86 | |
87 | $l_country_filter = "Filtrage en cours : "; |
||
88 | $l_country_filtering = " Filtrage par pays"; |
||
89 | $l_country_filtering_plus = " Filtrage par pays avancé"; |
||
90 | $l_phone_ban = " Numéro de téléphone bloqués"; |
||
91 | $l_country_france_ena = "Autorise les numéros français"; |
||
92 | $l_country_ue_ena = "Autorise les numéros européens"; |
||
93 | $l_country_all_ena = "Autorise tous les pays"; |
||
94 | $l_country_advanced_ena = "Autorisation personnalisé"; |
||
95 | $l_advance = "Avancé"; |
||
1349 | richard | 96 | } |
97 | else { |
||
98 | $l_title = "Auto registration (SMS)"; |
||
99 | $l_conf = "Configuration"; |
||
100 | $l_conf_actu = "Current configuration"; |
||
101 | $l_pin = "PIN password"; |
||
102 | $l_num_alcasar = "Phone number (3g key)"; |
||
103 | $l_ban_temp = "Max number of try before a permanent ban"; |
||
104 | $l_time_account = "Time for a new session"; |
||
105 | $l_time_perm = "Duration of a ban (for example, after X try)"; |
||
106 | $l_status_gammu = "Service status"; |
||
107 | $l_start = "Start"; |
||
108 | $l_status_device = "Status of your device"; |
||
1387 | richard | 109 | $l_key_diseable = "No device detected"; |
1349 | richard | 110 | $l_key_enable = "Your 3g key is connected"; |
111 | $l_force_signal = "Signal strength"; |
||
112 | $l_imei_device = "Device IMEI"; |
||
113 | $l_sms_received = "Number of SMS received"; |
||
114 | $l_stop = "Stop"; |
||
115 | $l_gammu_on="Gammu is running"; |
||
116 | $l_gammu_off="Gammu is down"; |
||
117 | $l_edit = "Edit"; |
||
118 | $l_error_label_empty = "Field empty"; |
||
119 | $l_error_label_num = "It's not a valid PIN password"; |
||
120 | $l_error_label_num2 = "It's not a number"; |
||
1380 | richard | 121 | $l_error_label_num3 = "The phone number is not good: +xxxYYYYYYYYY (xxx: code pays / YYYYYYYYY: numéro de téléphone)"; |
1387 | richard | 122 | $l_error_writefail = "Can not listen the ttyUSB0 port."; |
1349 | richard | 123 | $l_error_timeoutfail = "Timeout. Can not connect to modem."; |
124 | $l_error_simfail = "An issue with your Sim card was detected. Is it in the key?"; |
||
125 | $l_error_simsecu_l = "Warning, during the last startup, the PIN code was wrong. <br> |
||
126 | The Sim card must be blocked. Please read the documentation."; |
||
127 | $l_autorefresh = "Refresh : 30 sec"; |
||
128 | $l_days = "days "; |
||
129 | |||
130 | $l_num_block="List of blocked phone"; |
||
131 | $l_num_num="Phone number"; |
||
132 | $l_num_raison="Reason"; |
||
133 | $l_num_expiration="Expiration date"; |
||
134 | $l_num_action="Action"; |
||
135 | $l_num_exist="An account has been created"; |
||
136 | $l_num_flood="The number of try has been reached"; |
||
137 | $l_num_unlock="Erase"; |
||
1416 | richard | 138 | $l_country_enable="Enable"; |
139 | $l_country_disable="Disable"; |
||
1349 | richard | 140 | $l_service_status_img_ok="Running"; |
141 | $l_service_status_img_ko="Stopped"; |
||
1380 | richard | 142 | |
143 | $l_conf_name="Configuration : "; |
||
144 | $l_current_connect = "Connection"; |
||
1387 | richard | 145 | |
146 | $l_tab_first = "first"; |
||
147 | $l_tab_last = "last"; |
||
148 | $l_tab_next = "next"; |
||
149 | $l_tab_prev = "previous"; |
||
150 | $l_tab_search = "Search :"; |
||
151 | $l_tab_pmenu = "Showing _PAGE_ to _PAGE_ of _PAGE_ entries :"; |
||
152 | $l_tab_info = "Show _MENU_ entries"; |
||
153 | $l_tab_infoempty = "No matching records found"; |
||
1416 | richard | 154 | |
155 | $l_country_filter = "Current filtering : "; |
||
156 | $l_country_filtering = " Country filtering"; |
||
157 | $l_country_filtering_plus = " Country filtering advanced"; |
||
158 | $l_phone_ban = " Phone Number banned"; |
||
159 | $l_country_france_ena = "Authorize the french numbers"; |
||
160 | $l_country_ue_ena = "Authorize european numbers"; |
||
161 | $l_country_all_ena = "Authorize all countries"; |
||
162 | $l_country_advanced_ena = "Advanced Authorization"; |
||
163 | $l_advance = "Advanced"; |
||
1349 | richard | 164 | } |
1387 | richard | 165 | ?> |
166 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
||
167 | <HTML><!-- written by Rexy --> |
||
168 | <head> |
||
1416 | richard | 169 | <!--<META HTTP-EQUIV="Refresh" CONTENT="30">--> |
1387 | richard | 170 | <meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]"> |
171 | <title>Auto enregistrement</title> |
||
172 | <link rel="stylesheet" href="/css/style.css"> |
||
173 | <!-- DataTables CSS --> |
||
174 | <link rel="stylesheet" type="text/css" href="../../../css/jquery.dataTables.css"> |
||
175 | <!-- jQuery --> |
||
176 | <script type="text/javascript" charset="utf8" src="../../../js/jquery.js"></script> |
||
177 | <!-- DataTables --> |
||
178 | <script type="text/javascript" charset="utf8" src="../../../js/jquery.dataTables.js"></script> |
||
179 | <script type="text/javascript"> |
||
1416 | richard | 180 | function timedRefresh(timeoutPeriod) { |
181 | var interval = setInterval(refreshPage, timeoutPeriod); |
||
182 | } |
||
183 | |||
184 | function refreshPage() { |
||
185 | if ($("input[name=autoRefreshCheckboxes]").is(":checked")) { |
||
186 | location.reload(true); |
||
187 | } |
||
188 | } |
||
189 | |||
1387 | richard | 190 | $(document).ready( function () { |
1416 | richard | 191 | |
192 | $('#table_id').DataTable({ |
||
1387 | richard | 193 | "language": { |
194 | "paginate": { |
||
1416 | richard | 195 | "sFirst": "<?php echo $l_tab_first; ?>", |
1387 | richard | 196 | "sLast": "<?php echo $l_tab_last; ?>", |
197 | "sPrevious": "<?php echo $l_tab_prev; ?>", |
||
198 | "sNext": "<?php echo $l_tab_next; ?>" |
||
199 | }, |
||
200 | "lengthMenu": "<?php echo $l_tab_info; ?>", |
||
201 | "zeroRecords": "<?php echo $l_tab_infoempty; ?>", |
||
202 | "info": "<?php echo $l_tab_pmenu; ?>", |
||
203 | "infoEmpty": "<?php echo $l_tab_infoempty; ?>", |
||
204 | "sSearch": "<?php echo $l_tab_search; ?>" |
||
205 | } |
||
206 | }); |
||
1416 | richard | 207 | |
208 | $('#table_country').DataTable({ |
||
209 | "language": { |
||
210 | "paginate": { |
||
211 | "sFirst": "<?php echo $l_tab_first; ?>", |
||
212 | "sLast": "<?php echo $l_tab_last; ?>", |
||
213 | "sPrevious": "<?php echo $l_tab_prev; ?>", |
||
214 | "sNext": "<?php echo $l_tab_next; ?>" |
||
215 | }, |
||
216 | "lengthMenu": "<?php echo $l_tab_info; ?>", |
||
217 | "zeroRecords": "<?php echo $l_tab_infoempty; ?>", |
||
218 | "info": "<?php echo $l_tab_pmenu; ?>", |
||
219 | "infoEmpty": "<?php echo $l_tab_infoempty; ?>", |
||
220 | "sSearch": "<?php echo $l_tab_search; ?>" |
||
221 | } |
||
222 | }); |
||
223 | |||
224 | $(".showhide-div_country").slideUp("slow"); |
||
225 | $(".showhide-div_ban").slideUp("slow"); |
||
226 | $(".showhide-div_country_plus").slideUp("slow"); |
||
227 | |||
228 | $(".showhide-but_country").on("click", function(){ |
||
229 | $(".showhide-div_country").slideToggle("slow"); |
||
230 | }); |
||
231 | |||
232 | $(".showhide-but_country_plus").on("click", function(){ |
||
233 | $(".showhide-div_country_plus").slideToggle("slow"); |
||
234 | }); |
||
235 | |||
236 | $(".showhide-but_ban").on("click", function(){ |
||
237 | $(".showhide-div_ban").slideToggle("slow"); |
||
238 | }); |
||
239 | |||
1387 | richard | 240 | } ); |
241 | </script> |
||
242 | </head> |
||
1416 | richard | 243 | <body onload="JavaScript:timedRefresh(30000);"> |
1387 | richard | 244 | <TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> |
245 | <?php |
||
1349 | richard | 246 | echo " |
247 | <tr> |
||
248 | <th>$l_title</th> |
||
249 | </tr> |
||
250 | <tr bgcolor=\"#FFCC66\"> |
||
251 | <td><img src=\"/images/pix.gif\" width=\"1\" height=\"2\"></td> |
||
252 | </tr> |
||
253 | </TABLE> |
||
254 | <br /> |
||
1416 | richard | 255 | <input type='checkbox' checked='checked' name='autoRefreshCheckboxes' >".$l_autorefresh."</input> |
1349 | richard | 256 | "; |
257 | |||
258 | ?> |
||
259 | <center> |
||
260 | <br /><br /> |
||
261 | <table border=1 width=100%> |
||
262 | <tr> |
||
1380 | richard | 263 | <td colspan=3><h3><?php echo $l_status_device ?></h3></td> |
264 | </tr> |
||
265 | |||
266 | <tr> |
||
1349 | richard | 267 | <?php |
268 | if(!empty($exec_com) || !empty($exec_com2)) |
||
269 | { |
||
1380 | richard | 270 | |
271 | if(isset($_GET['config_submit'])){ |
||
272 | switch ($_GET['config']) { |
||
273 | case "at": |
||
274 | exec("sudo $script --replace_connect "); |
||
275 | break; |
||
276 | case "9600": |
||
277 | exec("sudo $script --replace_connect 9600"); |
||
278 | break; |
||
279 | case "19200": |
||
280 | exec("sudo $script --replace_connect 19200"); |
||
281 | break; |
||
282 | case "115200": |
||
283 | exec("sudo $script --replace_connect 115200"); |
||
284 | break; |
||
285 | |||
286 | } |
||
287 | } |
||
288 | |||
289 | $current_connect = exec("sudo $script --connect"); |
||
290 | |||
291 | |||
292 | echo '<td width="50%">'.$l_key_enable.'</td>'; |
||
293 | echo '<td width="20%">'.$l_current_connect.' : '.$current_connect.'</td>'; |
||
294 | echo ' <form form="GET" action="./autoregistration.php"> |
||
295 | <td align="right"> '.$l_conf_name.' |
||
296 | <select name="config"> |
||
297 | <option value="at">at</option> |
||
298 | <option value="9600">at9600</option> |
||
299 | <option value="19200">at19200</option> |
||
300 | <option value="115200">at115200</option> |
||
301 | </select> |
||
302 | <input type="submit" name="config_submit"></submit> |
||
303 | </td> |
||
304 | </form> |
||
305 | '; |
||
306 | |||
1349 | richard | 307 | $status_key="true"; |
308 | } |
||
309 | else |
||
310 | { |
||
311 | echo "<td>$l_key_diseable</td>"; |
||
312 | $status_key="false"; |
||
313 | } |
||
314 | ?> |
||
1380 | richard | 315 | </tr> |
1349 | richard | 316 | </table> |
317 | </center> |
||
318 | <br /><br /> |
||
319 | |||
320 | <?php |
||
321 | |||
1380 | richard | 322 | #Test si gammu est lancé |
323 | $gammu_pid=exec("sudo /sbin/pidof gammu-smsd"); |
||
1349 | richard | 324 | |
325 | |||
326 | if ($status_key=="false") |
||
327 | { |
||
328 | if ($gammu_pid!="") |
||
329 | { |
||
330 | exec("sudo $script stop"); |
||
331 | sleep(8); |
||
332 | header('Location: autoregistration.php'); |
||
333 | } |
||
334 | } |
||
335 | |||
336 | if ($status_key=="true") |
||
337 | { |
||
338 | #Nom du fichier de log lorsque gammu est démarré |
||
1387 | richard | 339 | #$file_log = "gammu-smsd.log"; |
1349 | richard | 340 | |
341 | #Recuperation du code PIN actuel |
||
342 | $current_pin = exec("sudo $script --pin"); |
||
343 | |||
344 | #Recuperation du nombre de try avant le ban perm |
||
345 | $current_try_ban = exec("sudo $script --try_ban"); |
||
346 | |||
347 | #Recuperation de la durée d'une session créée |
||
348 | $current_time_account = exec("sudo $script --time_account"); |
||
349 | |||
350 | #Recuperation de la durée dun ban perm (après flood) |
||
351 | $current_time_perm = exec("sudo $script --time_perm"); |
||
352 | |||
353 | #Detection neméro de tel |
||
354 | $current_num_alcasar = exec("sudo $script --numero_alcasar"); |
||
355 | |||
356 | #Detection problème avec la SIM |
||
357 | $current_simfail = exec("sudo $script --last_nosim"); |
||
358 | |||
359 | #Recuperation de la dernière ligne de START |
||
360 | $current_last_start = exec("sudo $script --last_start"); |
||
361 | |||
362 | #Recuperarion de la dernière ligne de STOP |
||
363 | $current_last_stop = exec("sudo $script --last_stop"); |
||
364 | |||
365 | #Recuperation de la dernière ligne de SECURITYERROR |
||
366 | $current_last_secu = exec("sudo $script --last_secu"); |
||
367 | |||
368 | #Recuperation de la dernière ligne de DEVICEWRITEERROR |
||
369 | $current_last_write = exec("sudo $script --last_writeerror"); |
||
370 | |||
371 | #Recuperation de la dernière ligne de TIMEOUT |
||
372 | $current_last_timeout = exec("sudo $script --last_timeout"); |
||
1380 | richard | 373 | |
374 | # Test si le service est lancé |
||
1349 | richard | 375 | if ($gammu_pid=="") |
376 | { |
||
377 | $force_signal = "-"; |
||
378 | $imei_device = "-"; |
||
379 | $sms_received = "-"; |
||
380 | |||
381 | $gammu="<td><img src=\"/images/state_error.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ko."\"></td><td>$l_gammu_off</td>"; |
||
382 | $gammu_status_on=""; |
||
383 | $gammu_status_off="disabled"; |
||
384 | |||
385 | if($current_last_secu!="") |
||
386 | { |
||
387 | if(($current_last_secu > $current_last_start) && ($current_last_secu < $current_last_stop)) |
||
388 | { |
||
389 | $gammu_simsecu="<tr><td colspan=7><font color=red>$l_error_simsecu_l</font></td></tr>"; |
||
390 | } |
||
391 | } |
||
392 | } else { |
||
393 | # Recuperation de la force du signal et IMEI et nombre de sms reçu |
||
394 | $val_force_signal = exec("sudo $script --signal_device"); |
||
395 | $imei_device = exec("sudo $script --imei_device"); |
||
396 | $sms_received = exec("sudo $script --sms_received"); |
||
397 | |||
398 | if ($val_force_signal < 21) { |
||
399 | $force_signal = "<img src=\"/images/signal_0.png\"> -- ".$val_force_signal." %"; |
||
400 | } elseif ($val_force_signal < 41) { |
||
401 | $force_signal = "<img src=\"/images/signal_20.png\"> -- ".$val_force_signal." %"; |
||
402 | |||
403 | } elseif ($val_force_signal < 61) { |
||
404 | $force_signal = "<img src=\"/images/signal_40.png\"> -- ".$val_force_signal." %"; |
||
405 | |||
406 | } elseif ($val_force_signal < 81) { |
||
407 | $force_signal = "<img src=\"/images/signal_60.png\"> -- ".$val_force_signal." %"; |
||
408 | |||
409 | } elseif ($val_force_signal < 101) { |
||
410 | $force_signal = "<img src=\"/images/signal_80.png\"> -- ".$val_force_signal." %"; |
||
411 | |||
412 | } |
||
413 | |||
414 | |||
415 | |||
416 | |||
417 | |||
418 | $gammu="<td><img src=\"/images/state_ok.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ok."\"></td><td>$l_gammu_on</td>"; |
||
1387 | richard | 419 | |
1349 | richard | 420 | |
421 | if($current_last_timeout!=""){ |
||
422 | if(($current_last_timeout > $current_last_start) && ($current_last_timeout > $current_last_stop)) |
||
423 | { |
||
424 | $gammu_timeout="<tr><td colspan=7><font color=red>$l_error_timeoutfail</font></td></tr>"; |
||
425 | } |
||
426 | } |
||
427 | |||
428 | if($current_last_secu!="") |
||
429 | { |
||
430 | if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop)) |
||
431 | { |
||
432 | exec("sudo $script --stop"); |
||
433 | } |
||
434 | } |
||
435 | |||
436 | if($current_last_write!=""){ |
||
437 | if(($current_last_write > $current_last_start) && ($current_last_write > $current_last_stop)) |
||
438 | { |
||
439 | $gammu_writeerror="<tr><td colspan=7><font color=red>$l_error_writefail</font></td></tr>"; |
||
440 | } |
||
441 | } |
||
442 | |||
443 | if($current_simfail!="") |
||
444 | { |
||
445 | if(($current_simfail > $current_last_start) && ($current_simfail > $current_last_stop)) |
||
446 | { |
||
1380 | richard | 447 | $gammu_simfail="<tr><td colspan=7><font color=red>$l_error_simfail</font></td></tr>"; |
1349 | richard | 448 | } |
449 | } |
||
450 | $gammu_status_on="disabled"; |
||
451 | $gammu_status_off=""; |
||
452 | } |
||
453 | |||
454 | |||
1380 | richard | 455 | #Lancement et arret de gammu-smsd 3*7sec |
1349 | richard | 456 | if(isset($_GET["start"])){ |
457 | $gammu_1=exec("sudo $script --start"); |
||
458 | sleep(7); |
||
459 | |||
460 | if($current_last_secu!="") |
||
461 | { |
||
462 | if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop)) |
||
463 | { |
||
464 | exec("sudo $script --stop"); |
||
465 | } |
||
466 | } |
||
467 | |||
468 | sleep(7); |
||
469 | if($current_last_secu!="") |
||
470 | { |
||
471 | if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop)) |
||
472 | { |
||
473 | exec("sudo $script --stop"); |
||
474 | } |
||
475 | } |
||
476 | |||
477 | sleep(7); |
||
478 | if($current_last_secu!="") |
||
479 | { |
||
480 | if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop)) |
||
481 | { |
||
482 | exec("sudo $script --stop"); |
||
483 | } |
||
484 | } |
||
485 | |||
486 | |||
487 | |||
488 | header('Location: autoregistration.php'); |
||
489 | } |
||
490 | |||
491 | if(isset($_GET["stop"])){ |
||
492 | exec("sudo $script --stop"); |
||
493 | sleep(8); |
||
494 | header('Location: autoregistration.php'); |
||
495 | } |
||
496 | |||
497 | |||
498 | #Edition du NUMERO de telephone |
||
499 | if(isset($_GET["b_num_alcasar"])){ |
||
500 | $num = $_GET["num_alcasar"]; |
||
501 | $error_num_alcasar = ""; |
||
502 | if($num !="") |
||
503 | { |
||
1380 | richard | 504 | if(preg_match('#^\+#',$num)) |
1349 | richard | 505 | { |
506 | exec("sudo $script --replace_numero_alcasar $num"); |
||
507 | header('Location: autoregistration.php'); |
||
508 | } |
||
509 | else |
||
510 | { |
||
1380 | richard | 511 | $error_num_alcasar=$l_error_label_num3; |
1349 | richard | 512 | } |
513 | } |
||
514 | else |
||
515 | { |
||
516 | $error_num_alcasar=$l_error_label_empty; |
||
517 | } |
||
518 | } |
||
519 | |||
520 | #Edition du code PIN |
||
521 | if(isset($_GET["b_pin"])){ |
||
522 | $pin = $_GET["pin"]; |
||
523 | $error_pin = ""; |
||
524 | if($pin !="") |
||
525 | { |
||
526 | if(is_numeric($pin)) |
||
527 | { |
||
528 | exec("sudo $script --replace_pin $pin"); |
||
529 | header('Location: autoregistration.php'); |
||
530 | } |
||
531 | else |
||
532 | { |
||
533 | $error_pin=$l_error_label_num; |
||
534 | } |
||
535 | } |
||
536 | else |
||
537 | { |
||
538 | $error_pin=$l_error_label_empty; |
||
539 | } |
||
540 | } |
||
1380 | richard | 541 | |
542 | |||
1349 | richard | 543 | #Edition du nombre d'essais avant le ban perm |
544 | if(isset($_GET["b_ban_temp"])){ |
||
545 | $nb_ban_temp = $_GET["nb_essais"]; |
||
546 | $error_nb_essais = ""; |
||
547 | if($nb_ban_temp !="") |
||
548 | { |
||
549 | if(is_numeric($nb_ban_temp)) |
||
550 | { |
||
551 | exec("sudo $script --replace_try_ban $nb_ban_temp"); |
||
552 | header('Location: autoregistration.php'); |
||
553 | } |
||
554 | else |
||
555 | { |
||
556 | $error_nb_essais=$l_error_label_num2; |
||
557 | } |
||
558 | } |
||
559 | else |
||
560 | { |
||
561 | $error_nb_essais=$l_error_label_empty; |
||
562 | } |
||
563 | } |
||
564 | |||
1380 | richard | 565 | |
1349 | richard | 566 | #Edition de la durée pour un compte créé |
567 | if(isset($_GET["b_time_account"])){ |
||
568 | $time_account = $_GET["time_account"]; |
||
569 | $error_time_account = ""; |
||
570 | if($time_account !="") |
||
571 | { |
||
572 | if(is_numeric($time_account)) |
||
573 | { |
||
574 | exec("sudo $script --replace_time_account $time_account"); |
||
575 | header('Location: autoregistration.php'); |
||
576 | } |
||
577 | else |
||
578 | { |
||
1380 | richard | 579 | $error_time_account=$l_error_label_num2; |
1349 | richard | 580 | } |
581 | } |
||
582 | else |
||
583 | { |
||
584 | $error_time_account=$l_error_label_empty; |
||
585 | } |
||
586 | } |
||
587 | |||
588 | #Edition de la durée d'un ban perm (après flood) |
||
589 | if(isset($_GET["b_time_perm"])){ |
||
590 | $time_perm = $_GET["time_perm"]; |
||
591 | $error_time_perm = ""; |
||
592 | if($time_perm !="") |
||
593 | { |
||
594 | if(is_numeric($time_perm)) |
||
595 | { |
||
596 | exec("sudo $script --replace_time_perm $time_perm"); |
||
597 | header('Location: autoregistration.php'); |
||
598 | } |
||
599 | else |
||
600 | { |
||
1380 | richard | 601 | $error_time_perm=$l_error_label_num2; |
1349 | richard | 602 | } |
603 | } |
||
604 | else |
||
605 | { |
||
606 | $error_time_perm=$l_error_label_empty; |
||
607 | } |
||
608 | } |
||
609 | |||
610 | # Suppression d'un numero bloqué |
||
611 | if(isset($_GET['num_select'])){ |
||
612 | $numero=$_GET['num_select']; |
||
613 | |||
614 | $add_mac=exec("sudo /usr/sbin/chilli_query list | grep $numero | cut -d ' ' -f1"); |
||
615 | exec("sudo /usr/sbin/chilli_query logout $add_mac"); |
||
616 | |||
617 | exec("sudo $script --unlock_num $numero"); |
||
618 | header('Location: autoregistration.php'); |
||
619 | } |
||
620 | |||
1416 | richard | 621 | # Edition etat pays |
622 | if(isset($_GET['country_select'])){ |
||
623 | $country=utf8_decode($_GET['country_select']); |
||
624 | exec("sudo $script --change_country $country"); |
||
625 | exec("sudo $script --change_country_filter advance"); |
||
626 | header('Location: autoregistration.php'); |
||
627 | } |
||
1349 | richard | 628 | |
1416 | richard | 629 | if(isset($_GET['b_france_enable'])){ |
630 | exec("sudo $script --change_country_dis_all"); |
||
631 | exec("sudo $script --change_country France"); |
||
632 | exec("sudo $script --change_country_filter fr"); |
||
633 | header('Location: autoregistration.php'); |
||
634 | } |
||
1349 | richard | 635 | |
1416 | richard | 636 | if(isset($_GET['b_ue_enable'])){ |
637 | exec("sudo $script --change_country_dis_all"); |
||
638 | $array_ue = array("Allemagne","Autriche","Belgique","Bulgarie","Chypre","Croatie","Danemark","Espagne","Estonie","Finlande","France","Grece","Hongrie","Irlande","Italie","Lettonie","Lituanie","Luxembourg","Malte","Pays-Bas"," Pologne","Portugal","Republique Tcheque","Roumanie","Angleterre","Slovaquie","Slovenie","Suede"); |
||
639 | foreach ($array_ue as $pays){ |
||
640 | exec("sudo $script --change_country $pays"); |
||
641 | } |
||
642 | |||
643 | exec("sudo $script --change_country_filter ue"); |
||
644 | header('Location: autoregistration.php'); |
||
645 | } |
||
646 | |||
647 | if(isset($_GET["b_country_enable"])){ |
||
648 | exec("sudo $script --change_country_ena_all"); |
||
649 | exec("sudo $script --change_country_filter all"); |
||
650 | header('Location: autoregistration.php'); |
||
651 | } |
||
652 | |||
653 | if(isset($_GET["b_country_disable"])){ |
||
654 | exec("sudo $script --change_country_dis_all"); |
||
655 | header('Location: autoregistration.php'); |
||
656 | } |
||
657 | |||
658 | |||
1349 | richard | 659 | #Si une clé 3g est plugué |
660 | echo "<form action=\"autoregistration.php\" methode=\"GET\"> |
||
661 | |||
662 | <table border=1> |
||
663 | <tr> |
||
1387 | richard | 664 | <td colspan=4><b>$l_status_gammu</b></td> |
665 | <td><b><center>$l_force_signal</center></b></td> |
||
666 | <td><b><center>$l_imei_device</center></b></td> |
||
667 | <td><b><center>$l_sms_received</center></b></td> |
||
1349 | richard | 668 | </tr> |
669 | <tr> |
||
1387 | richard | 670 | $gammu |
671 | <td><button type=\"submit\" name=\"start\" $gammu_status_on>$l_start</button></td> |
||
672 | <td><button type=\"submit\" name=\"stop\" $gammu_status_off>$l_stop</button></td> |
||
673 | <td><center>$force_signal</center></td> |
||
674 | <td><center>$imei_device</center></td> |
||
675 | <td><center>$sms_received</center></td> |
||
1349 | richard | 676 | </tr> |
677 | $gammu_puk |
||
678 | $gammu_simfail |
||
679 | $gammu_simsecu |
||
680 | $gammu_timeout |
||
681 | $gammu_writeerror |
||
682 | </table> |
||
683 | <br /><br /> |
||
684 | |||
685 | <table border=1> |
||
686 | <tr> |
||
687 | <td colspan=3><b>$l_conf</b></td> |
||
688 | <td><b>$l_conf_actu</b></td> |
||
689 | </tr> |
||
690 | |||
691 | <tr> |
||
1380 | richard | 692 | <td> $l_num_alcasar </td><td><input type=text name='num_alcasar' maxlength=\"20\"></td> |
1349 | richard | 693 | <td><button type=\"submit\" name=\"b_num_alcasar\" $gammu_status_on>$l_edit</button></td> |
694 | <td><center><font color=\"green\">$current_num_alcasar</font></center></td> |
||
695 | </tr> |
||
1380 | richard | 696 | <tr><td colspan=\"4\"><font color=red><b>$error_num_alcasar</b></font></td></tr> |
1349 | richard | 697 | |
1380 | richard | 698 | <tr> |
699 | <td> $l_pin </td><td><input type=text name='pin' maxlength=\"8\"></td> |
||
1349 | richard | 700 | <td><button type=\"submit\" name=\"b_pin\" $gammu_status_on>$l_edit</button></td> |
701 | <td><center><font color=\"green\">$current_pin</font></center></td> |
||
702 | </tr> |
||
1380 | richard | 703 | <tr><td colspan=\"4\"><font color=red><b>$error_pin</b></font></td></tr> |
704 | |||
705 | <td> $l_time_account </td><td><input type=text name='time_account'> $l_days </td> |
||
1349 | richard | 706 | <td><button type=\"submit\" name=\"b_time_account\" $gammu_status_on>$l_edit</button></td> |
707 | <td><center><font color=\"blue\">$current_time_account</font></center></td> |
||
708 | </tr> |
||
1380 | richard | 709 | <tr><td colspan=\"4\"><font color=red><b>$error_time_account</b></font></td></tr> |
1349 | richard | 710 | |
711 | <tr> |
||
1380 | richard | 712 | <td> $l_ban_temp </td><td><input type=text name='nb_essais'></td> |
1349 | richard | 713 | <td><button type=\"submit\" name=\"b_ban_temp\" $gammu_status_on>$l_edit</button></td> |
714 | <td><center><font color=\"orange\">$current_try_ban</font></center></td> |
||
715 | </tr> |
||
1380 | richard | 716 | <tr><td colspan=\"4\"><font color=red><b>$error_nb_essais</b></font></td></tr> |
1349 | richard | 717 | |
718 | <tr> |
||
1380 | richard | 719 | <td>$l_time_perm</td><td><input type=text name='time_perm'> $l_days</td> |
1349 | richard | 720 | <td><button type=\"submit\" name=\"b_time_perm\" $gammu_status_on>$l_edit</button></td> |
721 | <td><center><font color=\"orange\">$current_time_perm</font></center></td> |
||
722 | </tr> |
||
1380 | richard | 723 | <tr><td colspan=\"4\"><font color=red><b>$error_time_perm</b></font></td></tr> |
724 | |||
725 | |||
1349 | richard | 726 | </tr> |
727 | </table> |
||
1416 | richard | 728 | </form>"; |
729 | |||
1349 | richard | 730 | |
731 | require('/etc/freeradius-web/config.php'); |
||
732 | |||
733 | if (is_file("../../../pass/sql/drivers/$config[sql_type]/functions.php")) |
||
734 | include_once("../../../pass/sql/drivers/$config[sql_type]/functions.php"); |
||
735 | else{ |
||
736 | echo "<b>Could not include SQL library</b>\n"; |
||
737 | exit(); |
||
1416 | richard | 738 | } |
1349 | richard | 739 | |
740 | $con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu"); |
||
741 | |||
742 | if(mysqli_connect_errno()) |
||
743 | { |
||
744 | echo "Fail to connect to $config[sql_type]" . mysqli_connect_error(); |
||
745 | } |
||
746 | |||
747 | |||
1416 | richard | 748 | # Country table |
749 | |||
1387 | richard | 750 | ?> |
1416 | richard | 751 | |
752 | <div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;"> |
||
753 | <span class="showhide-but_country"><?php echo "<strong>$l_country_filtering<strong>" ?><img src="/images/down2.gif" width="15" height="15"></span> |
||
754 | |||
755 | <div class="showhide-div_country"> |
||
756 | <br /> |
||
757 | <table width=100% style="background: #BDBDBD;"> |
||
1349 | richard | 758 | <tr> |
1416 | richard | 759 | <?php |
760 | $result_country_filter = mysqli_query($con, "SELECT id FROM SMS_country WHERE name = 'FILTRAGE'"); |
||
761 | $row = mysqli_fetch_array($result_country_filter); |
||
762 | |||
763 | if($row['id'] == "advance") { |
||
764 | $country_filter = $l_country_advanced_ena; |
||
765 | } elseif($row['id'] == "ue") { |
||
766 | $country_filter = $l_country_ue_ena; |
||
767 | } elseif($row['id'] == "fr") { |
||
768 | $country_filter = $l_country_france_ena; |
||
769 | } elseif($row['id'] == "all") { |
||
770 | $country_filter = $l_country_all_ena; |
||
771 | } else { |
||
772 | $country_filter = "Err."; |
||
773 | } |
||
774 | ?> |
||
775 | <td colspan="3" align="center"><strong><?php echo $l_country_filter; ?></strong><font size="3" color="red"><?php echo $country_filter; ?></font></td> |
||
1349 | richard | 776 | </tr> |
1387 | richard | 777 | <tr> |
1416 | richard | 778 | <form action="autoregistration.php" methode="POST"> |
779 | <td align="center" width=33%><button type="submit" name="b_france_enable"><?php echo "$l_country_france_ena" ?></button></td> |
||
780 | <td align="center" width=34%><button type="submit" name="b_ue_enable"><?php echo "$l_country_ue_ena" ?></button></td> |
||
781 | <td align="center" width=33%><button type="submit" name="b_country_enable"><?php echo "$l_country_all_ena" ?></button></td> |
||
782 | </form> |
||
783 | </tr> |
||
784 | </table> |
||
785 | <div style="border-radius: 5px; background: #D8D8D8; margin: 15px;"> |
||
786 | <span class="showhide-but_country_plus"><?php echo "<strong>$l_country_filtering_plus<strong>" ?> <img src="/images/down2.gif" width="15" height="15"></span> |
||
787 | <div class="showhide-div_country_plus"> |
||
788 | <table id="table_country" class="display"> |
||
789 | <thead> |
||
790 | <tr> |
||
791 | <th><b><font color="black">Pays</font></b></th> |
||
792 | <th><b><font color="black">code</font></b></th> |
||
793 | <th><b><font color="black">Etat</font></b></th> |
||
794 | </tr> |
||
795 | </thead> |
||
796 | <tbody> |
||
797 | <?php |
||
798 | |||
799 | $result_country = mysqli_query($con, "SELECT * FROM SMS_country WHERE name != 'FILTRAGE'"); |
||
800 | while($row = mysqli_fetch_array($result_country)) |
||
801 | { |
||
802 | echo " |
||
803 | <tr> |
||
804 | <form action=\"autoregistration.php\" methode=\"POST\"> |
||
805 | <td> |
||
806 | <input type=\"hidden\" name=\"country_select\" value=\"" .$row['name']."\"> |
||
807 | ".$row['name']." |
||
808 | </td> |
||
809 | <td>".$row['id']."</td> |
||
810 | "; |
||
811 | |||
812 | if($row['status']=='0') |
||
813 | { |
||
814 | echo "<td><input type='image' src=\"/images/state_error.gif\" width=\"15\" height=\"15\"></td>"; |
||
815 | } |
||
816 | if($row['status']=='1') |
||
817 | { |
||
818 | echo "<td><input type='image' src=\"/images/state_ok.gif\" width=\"15\" height=\"15\"></td>"; |
||
819 | } |
||
820 | echo " </form> |
||
821 | </tr> |
||
822 | "; |
||
823 | } |
||
824 | ?> |
||
825 | </tbody> |
||
826 | </table> |
||
827 | </div> |
||
828 | </div> |
||
829 | </div> |
||
830 | </div> |
||
831 | <?php |
||
832 | $result = mysqli_query($con, "SELECT * FROM SMS_ban_perm"); |
||
833 | |||
834 | ?> |
||
835 | |||
836 | <div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;"> |
||
837 | <span class="showhide-but_ban"><?php echo "<strong>$l_phone_ban</strong>" ?><img src="/images/down2.gif" width="15" height="15"></span> |
||
838 | |||
839 | <div class="showhide-div_ban"> |
||
840 | |||
841 | <table id="table_id" class="display"> |
||
842 | <thead> |
||
843 | <tr> |
||
844 | <th><b><font color="black"><?php echo $l_num_num; ?></font></b></th> |
||
845 | <th><b><font color="black"><?php echo $l_num_raison; ?></font></b></th> |
||
846 | <th><b><font color="black"><?php echo $l_num_expiration; ?></font></b></th> |
||
847 | <th><b><font color="black">Action</font></b></th> |
||
848 | </tr> |
||
849 | </thead> |
||
850 | <tbody> |
||
851 | <?php |
||
852 | while($row = mysqli_fetch_array($result)) |
||
853 | { |
||
854 | echo " |
||
855 | <tr> |
||
856 | <form action=\"autoregistration.php\" methode=\"POST\"> |
||
857 | <td> |
||
858 | <input type=\"hidden\" name=\"num_select\" value=\"" .$row['SenderNumber']."\"> |
||
859 | ".$row['SenderNumber']." |
||
860 | </td>"; |
||
1349 | richard | 861 | |
1416 | richard | 862 | if($row['Perm']=='0') |
863 | { |
||
864 | echo "<td>$l_num_exist</td>"; |
||
865 | } |
||
866 | if($row['Perm']=='1') |
||
867 | { |
||
868 | echo "<td>$l_num_flood</td>"; |
||
869 | } |
||
870 | echo " <td>" . $row['Expiration']. "</td> |
||
871 | <td> |
||
872 | <input type='submit' value='".$l_num_unlock."'> |
||
873 | </td> |
||
874 | </form> |
||
875 | </tr> |
||
876 | "; |
||
877 | } |
||
878 | ?> |
||
879 | </tbody> |
||
880 | </table> |
||
881 | </div> |
||
882 | </div> |
||
1387 | richard | 883 | <?php |
1349 | richard | 884 | mysqli_close($con); |
1380 | richard | 885 | } |
1349 | richard | 886 | ?> |
887 | </html> |