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 = "";
|
|
|
22 |
|
|
|
23 |
# Choice of language
|
|
|
24 |
$Language = 'en';
|
|
|
25 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
1380 |
richard |
26 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
|
27 |
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
|
1349 |
richard |
28 |
if($Language == 'fr'){
|
|
|
29 |
$l_title = "Auto enregistrement (SMS)";
|
|
|
30 |
$l_conf = "Configuration";
|
|
|
31 |
$l_conf_actu = "Configuration actuelle";
|
|
|
32 |
$l_pin = "Code PIN";
|
|
|
33 |
$l_num_alcasar = "Le numero de téléphone de la clé 3G";
|
1380 |
richard |
34 |
$l_ban_temp = "Nombre d'essais avant le blocage";
|
1349 |
richard |
35 |
$l_time_account = "Durée pour une session créée";
|
1380 |
richard |
36 |
$l_time_perm = "Durée du blocage (en jours)";
|
1349 |
richard |
37 |
$l_status_gammu = "Etat du service";
|
|
|
38 |
$l_start = "Démarrer";
|
|
|
39 |
$l_status_device = "Status de votre périphérique";
|
1387 |
richard |
40 |
$l_key_diseable = "Aucun périphérique détecté";
|
1349 |
richard |
41 |
$l_key_enable = "Votre clé est connectée";
|
|
|
42 |
$l_force_signal = "Force du signal";
|
|
|
43 |
$l_imei_device = "IMEI du périphérique";
|
|
|
44 |
$l_sms_received = "Nombre de SMS reçu";
|
|
|
45 |
$l_stop = "Arrêter";
|
|
|
46 |
$l_gammu_on="Gammu est lancé";
|
|
|
47 |
$l_gammu_off="Gammu est arrêté";
|
|
|
48 |
$l_edit = "Editer";
|
|
|
49 |
$l_error_label_empty = "Le champ est vide";
|
|
|
50 |
$l_error_label_num = "Ce n'est pas un PIN valide";
|
|
|
51 |
$l_error_label_num2 = "Ce n'est pas un nombre";
|
1380 |
richard |
52 |
$l_error_label_num3 = "Le format n'est pas correct: +xxxYYYYYYYYY (xxx: code pays / YYYYYYYYY: numéro de téléphone)";
|
1387 |
richard |
53 |
$l_error_writefail = "Le service semble ne pas parvenir à discuter avec la clé (port ttyUSB0).";
|
1349 |
richard |
54 |
$l_error_timeoutfail = "Impossible de se connecter à la clé 3G. Timeout.";
|
|
|
55 |
$l_error_simfail = "Un problème au niveau de la carte SIM a été détecté. Est elle présente?";
|
|
|
56 |
$l_error_simsecu_l = "Attention, lors du dernier démarrage, votre code PIN était erroné.<br>
|
1380 |
richard |
57 |
La SIM doit être bloqué (code PUK). Consultez la documentation.";
|
1349 |
richard |
58 |
$l_autorefresh = "Rafraichissement : 30 sec";
|
|
|
59 |
$l_days = "jours ";
|
|
|
60 |
|
|
|
61 |
$l_num_block="Liste des numéros bloqués";
|
|
|
62 |
$l_num_num="Numéro";
|
|
|
63 |
$l_num_raison="Raison";
|
|
|
64 |
$l_num_expiration="Date d'expiration";
|
|
|
65 |
$l_num_action="Action";
|
|
|
66 |
$l_num_exist="Un compte a été créé";
|
|
|
67 |
$l_num_flood="Le nombre d'essais maximum a été dépacé";
|
|
|
68 |
$l_num_unlock="Effacer";
|
|
|
69 |
$l_service_status_img_ok="Démarré";
|
|
|
70 |
$l_service_status_img_ko="Arrété";
|
1380 |
richard |
71 |
|
|
|
72 |
$l_conf_name="Configuration : ";
|
|
|
73 |
$l_current_connect = "Connexion";
|
1349 |
richard |
74 |
|
1387 |
richard |
75 |
$l_tab_first = "premier";
|
|
|
76 |
$l_tab_last = "dernier";
|
|
|
77 |
$l_tab_next = "suivant";
|
|
|
78 |
$l_tab_prev = "précédent";
|
|
|
79 |
$l_tab_search = "Recherche :";
|
|
|
80 |
$l_tab_pmenu = "Affiche la page _PAGE_ sur _PAGES_";
|
|
|
81 |
$l_tab_info = "Montrer _MENU_ résultat par page";
|
|
|
82 |
$l_tab_infoempty = "Aucun résultat";
|
1349 |
richard |
83 |
}
|
|
|
84 |
else {
|
|
|
85 |
$l_title = "Auto registration (SMS)";
|
|
|
86 |
$l_conf = "Configuration";
|
|
|
87 |
$l_conf_actu = "Current configuration";
|
|
|
88 |
$l_pin = "PIN password";
|
|
|
89 |
$l_num_alcasar = "Phone number (3g key)";
|
|
|
90 |
$l_ban_temp = "Max number of try before a permanent ban";
|
|
|
91 |
$l_time_account = "Time for a new session";
|
|
|
92 |
$l_time_perm = "Duration of a ban (for example, after X try)";
|
|
|
93 |
$l_status_gammu = "Service status";
|
|
|
94 |
$l_start = "Start";
|
|
|
95 |
$l_status_device = "Status of your device";
|
1387 |
richard |
96 |
$l_key_diseable = "No device detected";
|
1349 |
richard |
97 |
$l_key_enable = "Your 3g key is connected";
|
|
|
98 |
$l_force_signal = "Signal strength";
|
|
|
99 |
$l_imei_device = "Device IMEI";
|
|
|
100 |
$l_sms_received = "Number of SMS received";
|
|
|
101 |
$l_stop = "Stop";
|
|
|
102 |
$l_gammu_on="Gammu is running";
|
|
|
103 |
$l_gammu_off="Gammu is down";
|
|
|
104 |
$l_edit = "Edit";
|
|
|
105 |
$l_error_label_empty = "Field empty";
|
|
|
106 |
$l_error_label_num = "It's not a valid PIN password";
|
|
|
107 |
$l_error_label_num2 = "It's not a number";
|
1380 |
richard |
108 |
$l_error_label_num3 = "The phone number is not good: +xxxYYYYYYYYY (xxx: code pays / YYYYYYYYY: numéro de téléphone)";
|
1387 |
richard |
109 |
$l_error_writefail = "Can not listen the ttyUSB0 port.";
|
1349 |
richard |
110 |
$l_error_timeoutfail = "Timeout. Can not connect to modem.";
|
|
|
111 |
$l_error_simfail = "An issue with your Sim card was detected. Is it in the key?";
|
|
|
112 |
$l_error_simsecu_l = "Warning, during the last startup, the PIN code was wrong. <br>
|
|
|
113 |
The Sim card must be blocked. Please read the documentation.";
|
|
|
114 |
$l_autorefresh = "Refresh : 30 sec";
|
|
|
115 |
$l_days = "days ";
|
|
|
116 |
|
|
|
117 |
$l_num_block="List of blocked phone";
|
|
|
118 |
$l_num_num="Phone number";
|
|
|
119 |
$l_num_raison="Reason";
|
|
|
120 |
$l_num_expiration="Expiration date";
|
|
|
121 |
$l_num_action="Action";
|
|
|
122 |
$l_num_exist="An account has been created";
|
|
|
123 |
$l_num_flood="The number of try has been reached";
|
|
|
124 |
$l_num_unlock="Erase";
|
|
|
125 |
$l_service_status_img_ok="Running";
|
|
|
126 |
$l_service_status_img_ko="Stopped";
|
1380 |
richard |
127 |
|
|
|
128 |
$l_conf_name="Configuration : ";
|
|
|
129 |
$l_current_connect = "Connection";
|
1387 |
richard |
130 |
|
|
|
131 |
$l_tab_first = "first";
|
|
|
132 |
$l_tab_last = "last";
|
|
|
133 |
$l_tab_next = "next";
|
|
|
134 |
$l_tab_prev = "previous";
|
|
|
135 |
$l_tab_search = "Search :";
|
|
|
136 |
$l_tab_pmenu = "Showing _PAGE_ to _PAGE_ of _PAGE_ entries :";
|
|
|
137 |
$l_tab_info = "Show _MENU_ entries";
|
|
|
138 |
$l_tab_infoempty = "No matching records found";
|
1349 |
richard |
139 |
}
|
1387 |
richard |
140 |
?>
|
|
|
141 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
|
142 |
<HTML><!-- written by Rexy -->
|
|
|
143 |
<head>
|
|
|
144 |
<META HTTP-EQUIV="Refresh" CONTENT="30">
|
|
|
145 |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
|
|
|
146 |
<title>Auto enregistrement</title>
|
|
|
147 |
<link rel="stylesheet" href="/css/style.css">
|
|
|
148 |
<!-- DataTables CSS -->
|
|
|
149 |
<link rel="stylesheet" type="text/css" href="../../../css/jquery.dataTables.css">
|
|
|
150 |
<!-- jQuery -->
|
|
|
151 |
<script type="text/javascript" charset="utf8" src="../../../js/jquery.js"></script>
|
|
|
152 |
<!-- DataTables -->
|
|
|
153 |
<script type="text/javascript" charset="utf8" src="../../../js/jquery.dataTables.js"></script>
|
|
|
154 |
<script type="text/javascript">
|
|
|
155 |
$(document).ready( function () {
|
|
|
156 |
$('#table_id').DataTable({
|
|
|
157 |
"language": {
|
|
|
158 |
"paginate": {
|
|
|
159 |
"sFirst": "<?php echo $l_tab_dirst; ?>",
|
|
|
160 |
"sLast": "<?php echo $l_tab_last; ?>",
|
|
|
161 |
"sPrevious": "<?php echo $l_tab_prev; ?>",
|
|
|
162 |
"sNext": "<?php echo $l_tab_next; ?>"
|
|
|
163 |
},
|
|
|
164 |
"lengthMenu": "<?php echo $l_tab_info; ?>",
|
|
|
165 |
"zeroRecords": "<?php echo $l_tab_infoempty; ?>",
|
|
|
166 |
"info": "<?php echo $l_tab_pmenu; ?>",
|
|
|
167 |
"infoEmpty": "<?php echo $l_tab_infoempty; ?>",
|
|
|
168 |
"sSearch": "<?php echo $l_tab_search; ?>"
|
|
|
169 |
}
|
|
|
170 |
});
|
|
|
171 |
} );
|
|
|
172 |
</script>
|
|
|
173 |
</head>
|
|
|
174 |
<body>
|
|
|
175 |
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
176 |
<?php
|
1349 |
richard |
177 |
echo "
|
|
|
178 |
<tr>
|
|
|
179 |
<th>$l_title</th>
|
|
|
180 |
</tr>
|
|
|
181 |
<tr bgcolor=\"#FFCC66\">
|
|
|
182 |
<td><img src=\"/images/pix.gif\" width=\"1\" height=\"2\"></td>
|
|
|
183 |
</tr>
|
|
|
184 |
</TABLE>
|
|
|
185 |
<br />
|
|
|
186 |
$l_autorefresh
|
|
|
187 |
";
|
|
|
188 |
|
|
|
189 |
?>
|
|
|
190 |
<center>
|
|
|
191 |
<br /><br />
|
|
|
192 |
<table border=1 width=100%>
|
|
|
193 |
<tr>
|
1380 |
richard |
194 |
<td colspan=3><h3><?php echo $l_status_device ?></h3></td>
|
|
|
195 |
</tr>
|
|
|
196 |
|
|
|
197 |
<tr>
|
1349 |
richard |
198 |
<?php
|
|
|
199 |
if(!empty($exec_com) || !empty($exec_com2))
|
|
|
200 |
{
|
1380 |
richard |
201 |
|
|
|
202 |
if(isset($_GET['config_submit'])){
|
|
|
203 |
switch ($_GET['config']) {
|
|
|
204 |
case "at":
|
|
|
205 |
exec("sudo $script --replace_connect ");
|
|
|
206 |
break;
|
|
|
207 |
case "9600":
|
|
|
208 |
exec("sudo $script --replace_connect 9600");
|
|
|
209 |
break;
|
|
|
210 |
case "19200":
|
|
|
211 |
exec("sudo $script --replace_connect 19200");
|
|
|
212 |
break;
|
|
|
213 |
case "115200":
|
|
|
214 |
exec("sudo $script --replace_connect 115200");
|
|
|
215 |
break;
|
|
|
216 |
|
|
|
217 |
}
|
|
|
218 |
}
|
|
|
219 |
|
|
|
220 |
$current_connect = exec("sudo $script --connect");
|
|
|
221 |
|
|
|
222 |
|
|
|
223 |
echo '<td width="50%">'.$l_key_enable.'</td>';
|
|
|
224 |
echo '<td width="20%">'.$l_current_connect.' : '.$current_connect.'</td>';
|
|
|
225 |
echo ' <form form="GET" action="./autoregistration.php">
|
|
|
226 |
<td align="right"> '.$l_conf_name.'
|
|
|
227 |
<select name="config">
|
|
|
228 |
<option value="at">at</option>
|
|
|
229 |
<option value="9600">at9600</option>
|
|
|
230 |
<option value="19200">at19200</option>
|
|
|
231 |
<option value="115200">at115200</option>
|
|
|
232 |
</select>
|
|
|
233 |
<input type="submit" name="config_submit"></submit>
|
|
|
234 |
</td>
|
|
|
235 |
</form>
|
|
|
236 |
';
|
|
|
237 |
|
1349 |
richard |
238 |
$status_key="true";
|
|
|
239 |
}
|
|
|
240 |
else
|
|
|
241 |
{
|
|
|
242 |
echo "<td>$l_key_diseable</td>";
|
|
|
243 |
$status_key="false";
|
|
|
244 |
}
|
|
|
245 |
?>
|
1380 |
richard |
246 |
</tr>
|
1349 |
richard |
247 |
</table>
|
|
|
248 |
</center>
|
|
|
249 |
<br /><br />
|
|
|
250 |
|
|
|
251 |
<?php
|
|
|
252 |
|
1380 |
richard |
253 |
#Test si gammu est lancé
|
|
|
254 |
$gammu_pid=exec("sudo /sbin/pidof gammu-smsd");
|
1349 |
richard |
255 |
|
|
|
256 |
|
|
|
257 |
if ($status_key=="false")
|
|
|
258 |
{
|
|
|
259 |
if ($gammu_pid!="")
|
|
|
260 |
{
|
|
|
261 |
exec("sudo $script stop");
|
|
|
262 |
sleep(8);
|
|
|
263 |
header('Location: autoregistration.php');
|
|
|
264 |
}
|
|
|
265 |
}
|
|
|
266 |
|
|
|
267 |
if ($status_key=="true")
|
|
|
268 |
{
|
|
|
269 |
#Nom du fichier de log lorsque gammu est démarré
|
1387 |
richard |
270 |
#$file_log = "gammu-smsd.log";
|
1349 |
richard |
271 |
|
|
|
272 |
#Recuperation du code PIN actuel
|
|
|
273 |
$current_pin = exec("sudo $script --pin");
|
|
|
274 |
|
|
|
275 |
#Recuperation du nombre de try avant le ban perm
|
|
|
276 |
$current_try_ban = exec("sudo $script --try_ban");
|
|
|
277 |
|
|
|
278 |
#Recuperation de la durée d'une session créée
|
|
|
279 |
$current_time_account = exec("sudo $script --time_account");
|
|
|
280 |
|
|
|
281 |
#Recuperation de la durée dun ban perm (après flood)
|
|
|
282 |
$current_time_perm = exec("sudo $script --time_perm");
|
|
|
283 |
|
|
|
284 |
#Detection neméro de tel
|
|
|
285 |
$current_num_alcasar = exec("sudo $script --numero_alcasar");
|
|
|
286 |
|
|
|
287 |
#Detection problème avec la SIM
|
|
|
288 |
$current_simfail = exec("sudo $script --last_nosim");
|
|
|
289 |
|
|
|
290 |
#Recuperation de la dernière ligne de START
|
|
|
291 |
$current_last_start = exec("sudo $script --last_start");
|
|
|
292 |
|
|
|
293 |
#Recuperarion de la dernière ligne de STOP
|
|
|
294 |
$current_last_stop = exec("sudo $script --last_stop");
|
|
|
295 |
|
|
|
296 |
#Recuperation de la dernière ligne de SECURITYERROR
|
|
|
297 |
$current_last_secu = exec("sudo $script --last_secu");
|
|
|
298 |
|
|
|
299 |
#Recuperation de la dernière ligne de DEVICEWRITEERROR
|
|
|
300 |
$current_last_write = exec("sudo $script --last_writeerror");
|
|
|
301 |
|
|
|
302 |
#Recuperation de la dernière ligne de TIMEOUT
|
|
|
303 |
$current_last_timeout = exec("sudo $script --last_timeout");
|
1380 |
richard |
304 |
|
|
|
305 |
# Test si le service est lancé
|
1349 |
richard |
306 |
if ($gammu_pid=="")
|
|
|
307 |
{
|
|
|
308 |
$force_signal = "-";
|
|
|
309 |
$imei_device = "-";
|
|
|
310 |
$sms_received = "-";
|
|
|
311 |
|
|
|
312 |
$gammu="<td><img src=\"/images/state_error.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ko."\"></td><td>$l_gammu_off</td>";
|
|
|
313 |
$gammu_status_on="";
|
|
|
314 |
$gammu_status_off="disabled";
|
|
|
315 |
|
|
|
316 |
if($current_last_secu!="")
|
|
|
317 |
{
|
|
|
318 |
if(($current_last_secu > $current_last_start) && ($current_last_secu < $current_last_stop))
|
|
|
319 |
{
|
|
|
320 |
$gammu_simsecu="<tr><td colspan=7><font color=red>$l_error_simsecu_l</font></td></tr>";
|
|
|
321 |
}
|
|
|
322 |
}
|
|
|
323 |
} else {
|
|
|
324 |
# Recuperation de la force du signal et IMEI et nombre de sms reçu
|
|
|
325 |
$val_force_signal = exec("sudo $script --signal_device");
|
|
|
326 |
$imei_device = exec("sudo $script --imei_device");
|
|
|
327 |
$sms_received = exec("sudo $script --sms_received");
|
|
|
328 |
|
|
|
329 |
if ($val_force_signal < 21) {
|
|
|
330 |
$force_signal = "<img src=\"/images/signal_0.png\"> -- ".$val_force_signal." %";
|
|
|
331 |
} elseif ($val_force_signal < 41) {
|
|
|
332 |
$force_signal = "<img src=\"/images/signal_20.png\"> -- ".$val_force_signal." %";
|
|
|
333 |
|
|
|
334 |
} elseif ($val_force_signal < 61) {
|
|
|
335 |
$force_signal = "<img src=\"/images/signal_40.png\"> -- ".$val_force_signal." %";
|
|
|
336 |
|
|
|
337 |
} elseif ($val_force_signal < 81) {
|
|
|
338 |
$force_signal = "<img src=\"/images/signal_60.png\"> -- ".$val_force_signal." %";
|
|
|
339 |
|
|
|
340 |
} elseif ($val_force_signal < 101) {
|
|
|
341 |
$force_signal = "<img src=\"/images/signal_80.png\"> -- ".$val_force_signal." %";
|
|
|
342 |
|
|
|
343 |
}
|
|
|
344 |
|
|
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
|
348 |
|
|
|
349 |
$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 |
350 |
|
1349 |
richard |
351 |
|
|
|
352 |
if($current_last_timeout!=""){
|
|
|
353 |
if(($current_last_timeout > $current_last_start) && ($current_last_timeout > $current_last_stop))
|
|
|
354 |
{
|
|
|
355 |
$gammu_timeout="<tr><td colspan=7><font color=red>$l_error_timeoutfail</font></td></tr>";
|
|
|
356 |
}
|
|
|
357 |
}
|
|
|
358 |
|
|
|
359 |
if($current_last_secu!="")
|
|
|
360 |
{
|
|
|
361 |
if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
|
|
|
362 |
{
|
|
|
363 |
exec("sudo $script --stop");
|
|
|
364 |
}
|
|
|
365 |
}
|
|
|
366 |
|
|
|
367 |
if($current_last_write!=""){
|
|
|
368 |
if(($current_last_write > $current_last_start) && ($current_last_write > $current_last_stop))
|
|
|
369 |
{
|
|
|
370 |
$gammu_writeerror="<tr><td colspan=7><font color=red>$l_error_writefail</font></td></tr>";
|
|
|
371 |
}
|
|
|
372 |
}
|
|
|
373 |
|
|
|
374 |
if($current_simfail!="")
|
|
|
375 |
{
|
|
|
376 |
if(($current_simfail > $current_last_start) && ($current_simfail > $current_last_stop))
|
|
|
377 |
{
|
1380 |
richard |
378 |
$gammu_simfail="<tr><td colspan=7><font color=red>$l_error_simfail</font></td></tr>";
|
1349 |
richard |
379 |
}
|
|
|
380 |
}
|
|
|
381 |
$gammu_status_on="disabled";
|
|
|
382 |
$gammu_status_off="";
|
|
|
383 |
}
|
|
|
384 |
|
|
|
385 |
|
1380 |
richard |
386 |
#Lancement et arret de gammu-smsd 3*7sec
|
1349 |
richard |
387 |
if(isset($_GET["start"])){
|
|
|
388 |
$gammu_1=exec("sudo $script --start");
|
|
|
389 |
sleep(7);
|
|
|
390 |
|
|
|
391 |
if($current_last_secu!="")
|
|
|
392 |
{
|
|
|
393 |
if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
|
|
|
394 |
{
|
|
|
395 |
exec("sudo $script --stop");
|
|
|
396 |
}
|
|
|
397 |
}
|
|
|
398 |
|
|
|
399 |
sleep(7);
|
|
|
400 |
if($current_last_secu!="")
|
|
|
401 |
{
|
|
|
402 |
if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
|
|
|
403 |
{
|
|
|
404 |
exec("sudo $script --stop");
|
|
|
405 |
}
|
|
|
406 |
}
|
|
|
407 |
|
|
|
408 |
sleep(7);
|
|
|
409 |
if($current_last_secu!="")
|
|
|
410 |
{
|
|
|
411 |
if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
|
|
|
412 |
{
|
|
|
413 |
exec("sudo $script --stop");
|
|
|
414 |
}
|
|
|
415 |
}
|
|
|
416 |
|
|
|
417 |
|
|
|
418 |
|
|
|
419 |
header('Location: autoregistration.php');
|
|
|
420 |
}
|
|
|
421 |
|
|
|
422 |
if(isset($_GET["stop"])){
|
|
|
423 |
exec("sudo $script --stop");
|
|
|
424 |
sleep(8);
|
|
|
425 |
header('Location: autoregistration.php');
|
|
|
426 |
}
|
|
|
427 |
|
|
|
428 |
|
|
|
429 |
#Edition du NUMERO de telephone
|
|
|
430 |
if(isset($_GET["b_num_alcasar"])){
|
|
|
431 |
$num = $_GET["num_alcasar"];
|
|
|
432 |
$error_num_alcasar = "";
|
|
|
433 |
if($num !="")
|
|
|
434 |
{
|
1380 |
richard |
435 |
if(preg_match('#^\+#',$num))
|
1349 |
richard |
436 |
{
|
|
|
437 |
exec("sudo $script --replace_numero_alcasar $num");
|
|
|
438 |
header('Location: autoregistration.php');
|
|
|
439 |
}
|
|
|
440 |
else
|
|
|
441 |
{
|
1380 |
richard |
442 |
$error_num_alcasar=$l_error_label_num3;
|
1349 |
richard |
443 |
}
|
|
|
444 |
}
|
|
|
445 |
else
|
|
|
446 |
{
|
|
|
447 |
$error_num_alcasar=$l_error_label_empty;
|
|
|
448 |
}
|
|
|
449 |
}
|
|
|
450 |
|
|
|
451 |
#Edition du code PIN
|
|
|
452 |
if(isset($_GET["b_pin"])){
|
|
|
453 |
$pin = $_GET["pin"];
|
|
|
454 |
$error_pin = "";
|
|
|
455 |
if($pin !="")
|
|
|
456 |
{
|
|
|
457 |
if(is_numeric($pin))
|
|
|
458 |
{
|
|
|
459 |
exec("sudo $script --replace_pin $pin");
|
|
|
460 |
header('Location: autoregistration.php');
|
|
|
461 |
}
|
|
|
462 |
else
|
|
|
463 |
{
|
|
|
464 |
$error_pin=$l_error_label_num;
|
|
|
465 |
}
|
|
|
466 |
}
|
|
|
467 |
else
|
|
|
468 |
{
|
|
|
469 |
$error_pin=$l_error_label_empty;
|
|
|
470 |
}
|
|
|
471 |
}
|
1380 |
richard |
472 |
|
|
|
473 |
|
1349 |
richard |
474 |
#Edition du nombre d'essais avant le ban perm
|
|
|
475 |
if(isset($_GET["b_ban_temp"])){
|
|
|
476 |
$nb_ban_temp = $_GET["nb_essais"];
|
|
|
477 |
$error_nb_essais = "";
|
|
|
478 |
if($nb_ban_temp !="")
|
|
|
479 |
{
|
|
|
480 |
if(is_numeric($nb_ban_temp))
|
|
|
481 |
{
|
|
|
482 |
exec("sudo $script --replace_try_ban $nb_ban_temp");
|
|
|
483 |
header('Location: autoregistration.php');
|
|
|
484 |
}
|
|
|
485 |
else
|
|
|
486 |
{
|
|
|
487 |
$error_nb_essais=$l_error_label_num2;
|
|
|
488 |
}
|
|
|
489 |
}
|
|
|
490 |
else
|
|
|
491 |
{
|
|
|
492 |
$error_nb_essais=$l_error_label_empty;
|
|
|
493 |
}
|
|
|
494 |
}
|
|
|
495 |
|
1380 |
richard |
496 |
|
1349 |
richard |
497 |
#Edition de la durée pour un compte créé
|
|
|
498 |
if(isset($_GET["b_time_account"])){
|
|
|
499 |
$time_account = $_GET["time_account"];
|
|
|
500 |
$error_time_account = "";
|
|
|
501 |
if($time_account !="")
|
|
|
502 |
{
|
|
|
503 |
if(is_numeric($time_account))
|
|
|
504 |
{
|
|
|
505 |
exec("sudo $script --replace_time_account $time_account");
|
|
|
506 |
header('Location: autoregistration.php');
|
|
|
507 |
}
|
|
|
508 |
else
|
|
|
509 |
{
|
1380 |
richard |
510 |
$error_time_account=$l_error_label_num2;
|
1349 |
richard |
511 |
}
|
|
|
512 |
}
|
|
|
513 |
else
|
|
|
514 |
{
|
|
|
515 |
$error_time_account=$l_error_label_empty;
|
|
|
516 |
}
|
|
|
517 |
}
|
|
|
518 |
|
|
|
519 |
#Edition de la durée d'un ban perm (après flood)
|
|
|
520 |
if(isset($_GET["b_time_perm"])){
|
|
|
521 |
$time_perm = $_GET["time_perm"];
|
|
|
522 |
$error_time_perm = "";
|
|
|
523 |
if($time_perm !="")
|
|
|
524 |
{
|
|
|
525 |
if(is_numeric($time_perm))
|
|
|
526 |
{
|
|
|
527 |
exec("sudo $script --replace_time_perm $time_perm");
|
|
|
528 |
header('Location: autoregistration.php');
|
|
|
529 |
}
|
|
|
530 |
else
|
|
|
531 |
{
|
1380 |
richard |
532 |
$error_time_perm=$l_error_label_num2;
|
1349 |
richard |
533 |
}
|
|
|
534 |
}
|
|
|
535 |
else
|
|
|
536 |
{
|
|
|
537 |
$error_time_perm=$l_error_label_empty;
|
|
|
538 |
}
|
|
|
539 |
}
|
|
|
540 |
|
|
|
541 |
# Suppression d'un numero bloqué
|
|
|
542 |
if(isset($_GET['num_select'])){
|
|
|
543 |
$numero=$_GET['num_select'];
|
|
|
544 |
|
|
|
545 |
$add_mac=exec("sudo /usr/sbin/chilli_query list | grep $numero | cut -d ' ' -f1");
|
|
|
546 |
exec("sudo /usr/sbin/chilli_query logout $add_mac");
|
|
|
547 |
|
|
|
548 |
exec("sudo $script --unlock_num $numero");
|
|
|
549 |
header('Location: autoregistration.php');
|
|
|
550 |
}
|
|
|
551 |
|
|
|
552 |
|
|
|
553 |
|
|
|
554 |
#Si une clé 3g est plugué
|
|
|
555 |
echo "<form action=\"autoregistration.php\" methode=\"GET\">
|
|
|
556 |
|
|
|
557 |
<table border=1>
|
|
|
558 |
<tr>
|
1387 |
richard |
559 |
<td colspan=4><b>$l_status_gammu</b></td>
|
|
|
560 |
<td><b><center>$l_force_signal</center></b></td>
|
|
|
561 |
<td><b><center>$l_imei_device</center></b></td>
|
|
|
562 |
<td><b><center>$l_sms_received</center></b></td>
|
1349 |
richard |
563 |
</tr>
|
|
|
564 |
<tr>
|
1387 |
richard |
565 |
$gammu
|
|
|
566 |
<td><button type=\"submit\" name=\"start\" $gammu_status_on>$l_start</button></td>
|
|
|
567 |
<td><button type=\"submit\" name=\"stop\" $gammu_status_off>$l_stop</button></td>
|
|
|
568 |
<td><center>$force_signal</center></td>
|
|
|
569 |
<td><center>$imei_device</center></td>
|
|
|
570 |
<td><center>$sms_received</center></td>
|
1349 |
richard |
571 |
</tr>
|
|
|
572 |
$gammu_puk
|
|
|
573 |
$gammu_simfail
|
|
|
574 |
$gammu_simsecu
|
|
|
575 |
$gammu_timeout
|
|
|
576 |
$gammu_writeerror
|
|
|
577 |
</table>
|
|
|
578 |
<br /><br />
|
|
|
579 |
|
|
|
580 |
<table border=1>
|
|
|
581 |
<tr>
|
|
|
582 |
<td colspan=3><b>$l_conf</b></td>
|
|
|
583 |
<td><b>$l_conf_actu</b></td>
|
|
|
584 |
</tr>
|
|
|
585 |
|
|
|
586 |
<tr>
|
1380 |
richard |
587 |
<td> $l_num_alcasar </td><td><input type=text name='num_alcasar' maxlength=\"20\"></td>
|
1349 |
richard |
588 |
<td><button type=\"submit\" name=\"b_num_alcasar\" $gammu_status_on>$l_edit</button></td>
|
|
|
589 |
<td><center><font color=\"green\">$current_num_alcasar</font></center></td>
|
|
|
590 |
</tr>
|
1380 |
richard |
591 |
<tr><td colspan=\"4\"><font color=red><b>$error_num_alcasar</b></font></td></tr>
|
1349 |
richard |
592 |
|
1380 |
richard |
593 |
<tr>
|
|
|
594 |
<td> $l_pin </td><td><input type=text name='pin' maxlength=\"8\"></td>
|
1349 |
richard |
595 |
<td><button type=\"submit\" name=\"b_pin\" $gammu_status_on>$l_edit</button></td>
|
|
|
596 |
<td><center><font color=\"green\">$current_pin</font></center></td>
|
|
|
597 |
</tr>
|
1380 |
richard |
598 |
<tr><td colspan=\"4\"><font color=red><b>$error_pin</b></font></td></tr>
|
|
|
599 |
|
|
|
600 |
<td> $l_time_account </td><td><input type=text name='time_account'> $l_days </td>
|
1349 |
richard |
601 |
<td><button type=\"submit\" name=\"b_time_account\" $gammu_status_on>$l_edit</button></td>
|
|
|
602 |
<td><center><font color=\"blue\">$current_time_account</font></center></td>
|
|
|
603 |
</tr>
|
1380 |
richard |
604 |
<tr><td colspan=\"4\"><font color=red><b>$error_time_account</b></font></td></tr>
|
1349 |
richard |
605 |
|
|
|
606 |
<tr>
|
1380 |
richard |
607 |
<td> $l_ban_temp </td><td><input type=text name='nb_essais'></td>
|
1349 |
richard |
608 |
<td><button type=\"submit\" name=\"b_ban_temp\" $gammu_status_on>$l_edit</button></td>
|
|
|
609 |
<td><center><font color=\"orange\">$current_try_ban</font></center></td>
|
|
|
610 |
</tr>
|
1380 |
richard |
611 |
<tr><td colspan=\"4\"><font color=red><b>$error_nb_essais</b></font></td></tr>
|
1349 |
richard |
612 |
|
|
|
613 |
<tr>
|
1380 |
richard |
614 |
<td>$l_time_perm</td><td><input type=text name='time_perm'> $l_days</td>
|
1349 |
richard |
615 |
<td><button type=\"submit\" name=\"b_time_perm\" $gammu_status_on>$l_edit</button></td>
|
|
|
616 |
<td><center><font color=\"orange\">$current_time_perm</font></center></td>
|
|
|
617 |
</tr>
|
1380 |
richard |
618 |
<tr><td colspan=\"4\"><font color=red><b>$error_time_perm</b></font></td></tr>
|
|
|
619 |
|
|
|
620 |
|
1349 |
richard |
621 |
</tr>
|
|
|
622 |
</table>
|
|
|
623 |
</form>";
|
|
|
624 |
|
|
|
625 |
|
|
|
626 |
require('/etc/freeradius-web/config.php');
|
|
|
627 |
|
|
|
628 |
if (is_file("../../../pass/sql/drivers/$config[sql_type]/functions.php"))
|
|
|
629 |
include_once("../../../pass/sql/drivers/$config[sql_type]/functions.php");
|
|
|
630 |
else{
|
|
|
631 |
echo "<b>Could not include SQL library</b>\n";
|
|
|
632 |
exit();
|
|
|
633 |
}
|
|
|
634 |
|
|
|
635 |
|
|
|
636 |
$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
|
|
|
637 |
|
|
|
638 |
if(mysqli_connect_errno())
|
|
|
639 |
{
|
|
|
640 |
echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
|
|
|
641 |
}
|
|
|
642 |
|
|
|
643 |
$result = mysqli_query($con, "SELECT * FROM SMS_ban_perm");
|
|
|
644 |
|
1387 |
richard |
645 |
?>
|
|
|
646 |
<table id="table_id" class="display">
|
|
|
647 |
<thead>
|
1349 |
richard |
648 |
<tr>
|
1387 |
richard |
649 |
<th><b><font color="black"><?php echo $l_num_num; ?></font></b></th>
|
|
|
650 |
<th><b><font color="black"><?php echo $l_num_raison; ?></font></b></th>
|
|
|
651 |
<th><b><font color="black"><?php echo $l_num_expiration; ?></font></b></th>
|
|
|
652 |
<th><b><font color="black">Action</font></b></th>
|
1349 |
richard |
653 |
</tr>
|
1387 |
richard |
654 |
</thead>
|
|
|
655 |
<tbody>
|
|
|
656 |
<?php
|
1349 |
richard |
657 |
while($row = mysqli_fetch_array($result))
|
|
|
658 |
{
|
|
|
659 |
echo "
|
1387 |
richard |
660 |
<tr>
|
1349 |
richard |
661 |
<form action=\"autoregistration.php\" methode=\"POST\">
|
|
|
662 |
<td>
|
1380 |
richard |
663 |
<input type=\"hidden\" name=\"num_select\" value=\"" .$row['SenderNumber']."\">
|
1387 |
richard |
664 |
".$row['SenderNumber']."
|
|
|
665 |
</td>";
|
1349 |
richard |
666 |
|
|
|
667 |
if($row['Perm']=='0')
|
|
|
668 |
{
|
|
|
669 |
echo "<td>$l_num_exist</td>";
|
|
|
670 |
}
|
|
|
671 |
if($row['Perm']=='1')
|
|
|
672 |
{
|
|
|
673 |
echo "<td>$l_num_flood</td>";
|
|
|
674 |
}
|
|
|
675 |
echo " <td>" . $row['Expiration']. "</td>
|
1387 |
richard |
676 |
<td>
|
|
|
677 |
<input type='submit' value='".$l_num_unlock."'>
|
|
|
678 |
</td>
|
|
|
679 |
</form>
|
|
|
680 |
</tr>
|
|
|
681 |
";
|
1349 |
richard |
682 |
}
|
1387 |
richard |
683 |
?>
|
|
|
684 |
</tbody>
|
|
|
685 |
</table>
|
|
|
686 |
<?php
|
1349 |
richard |
687 |
mysqli_close($con);
|
1380 |
richard |
688 |
}
|
1349 |
richard |
689 |
?>
|
|
|
690 |
</html>
|