Subversion Repositories ALCASAR

Rev

Rev 2542 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2542 Rev 2550
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: autoregistration.php 2542 2018-05-04 17:12:28Z rexy $
2
# $Id: autoregistration.php 2550 2018-05-06 22:15:20Z rexy $
3
 
-
 
4
# Test if 3G/4G key is plugged 
-
 
5
$exec_com=exec("lsusb | grep -i 067b: | cut -d ' ' -f6"); // converter "USB to UART" PL2303 (several USB-serial cables, Wavecom GSM Modem)
-
 
6
$exec_com2=exec("lsusb | grep -i 12d1: | cut -d ' ' -f6"); // Huawei Technologies (E220/E230/E270/E870
-
 
7
$gammu_smsd_port=exec("cat /etc/gammu_smsd_conf| grep port | cut -d ' ' -f3"); // Gammu_smsd listen port 
-
 
8
$model='';
-
 
9
if(!empty($exec_com) || !empty($exec_com2)){
-
 
10
	$status_key="true";
-
 
11
	if(!empty($exec_com)) $model='Wavecom';
-
 
12
	if(!empty($exec_com2)) $model='Huawei';
-
 
13
	exec("ls /dev/ttyUSB*",$openned_ports); // list of ports openned by the modem 
-
 
14
	}
-
 
15
else {
-
 
16
	$status_key="false";
-
 
17
}
-
 
18
 
-
 
19
$script="/usr/local/bin/alcasar-sms.sh";
-
 
20
 
3
 
21
#Define
4
#Define
22
$gammu_puk = "";
5
$gammu_puk = "";
23
$gammu_simfail = "";
6
$gammu_simfail = "";
24
$gammu_simsecu = "";
7
$gammu_simsecu = "";
Line 28... Line 11...
28
$error_time_account = "";
11
$error_time_account = "";
29
$error_nb_essais = "";
12
$error_nb_essais = "";
30
$error_time_perm = "";
13
$error_time_perm = "";
31
$error_num_alcasar = "";
14
$error_num_alcasar = "";
32
$country_filter="";
15
$country_filter="";
-
 
16
$find_key="false";
-
 
17
$status_key="false";
-
 
18
$script="/usr/local/bin/alcasar-sms.sh";
-
 
19
 
-
 
20
# Test if a modem is plugged on serial-usb port
-
 
21
$open_port=exec("ls /dev/ttyUSB*",$openned_ports); // list of USB-Serial ports openned by a modem
-
 
22
if (!empty($open_port))
-
 
23
{
-
 
24
	$find_key="true";
-
 
25
	$vendor=exec("udevadm info -n $openned_ports[1] | grep 'MODEL=' | cut -d'=' -f2");
-
 
26
	$model=exec("udevadm info -n $openned_ports[1] | grep 'MODEL_FROM_DATABASE=' | cut -d'=' -f2");
-
 
27
	$gammu_smsd_port=exec("cat /etc/gammu_smsd_conf| grep port | cut -d ' ' -f3"); // Gammu_smsd listen port
-
 
28
	while ( list(,$row) = each($openned_ports))
-
 
29
	{
-
 
30
		if ( "$row" == "$gammu_smsd_port" ) // is gammu listen on an openned port ?
-
 
31
		{
-
 
32
			$status_key="true";
-
 
33
		}
-
 
34
	}
-
 
35
}	
-
 
36
$gammu_pid=exec("sudo $script --pidof");
-
 
37
if (( $status_key == "false") || ($find_key == "false"))
-
 
38
{	# close gammu if it's started
-
 
39
	if ($gammu_pid!="")
-
 
40
	{
-
 
41
		echo "on ferme";
-
 
42
		exec("sudo $script stop");
-
 
43
		sleep(8);
-
 
44
		header('Location: autoregistration.php');
-
 
45
		exit();
-
 
46
	}
-
 
47
}
33
 
48
 
34
# Choice of language
49
# Choice of language
35
$Language = 'en';
50
$Language = 'en';
36
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
51
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
37
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
52
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
Line 41... Line 56...
41
	$l_conf = "Configuration";
56
	$l_conf = "Configuration";
42
	$l_conf_actu = "Configuration actuelle";
57
	$l_conf_actu = "Configuration actuelle";
43
	$l_pin = "Code PIN";
58
	$l_pin = "Code PIN";
44
	$l_num_alcasar = "Numero de téléphone du MODEM GSM";
59
	$l_num_alcasar = "Numero de téléphone du MODEM GSM";
45
	$l_ban_temp = "Nombre d'essais avant le blocage";
60
	$l_ban_temp = "Nombre d'essais avant le blocage";
46
	$l_time_account = "Durée pour une session créée";
61
	$l_time_account = "Durée de validité des comptes crées";
47
	$l_time_perm = "Durée du blocage (en jours)";
62
	$l_time_perm = "Durée du blocage (en jours)";
48
	$l_status_gammu = "Etat du service";
63
	$l_status_gammu = "Etat du service";
49
	$l_start = "Démarrer";
64
	$l_start = "Démarrer";
50
	$l_status_device = "Status de votre MODEM GSM (clé 2G/3G/4G)";
65
	$l_status_device = "Status de votre MODEM GSM (clé 2G/3G/4G)";
51
	$l_key_diseable = "Aucun périphérique détecté";
66
	$l_key_diseable = "Aucun périphérique détecté";
52
	$l_key_enable_1 = "Un MODEM GSM '<b>".$model."</b>' est connecté à la vitesse de ";
67
	$l_key_enable_1 = "Un MODEM GSM '<b>".$vendor."(".$model.")</b>' est connecté à la vitesse de ";
53
	$l_key_enable_2 = "Il a ouvert les ports suivants : ";
68
	$l_key_enable_2 = "Il a ouvert les ports suivants : ";
54
	$l_key_enable_3 = "ALCASAR le gère actuellement sur le port : <b>".$gammu_smsd_port."</b>";
-
 
55
	$l_force_signal = "Force du signal";
69
	$l_force_signal = "Force du signal";
56
	$l_imei_device = "IMEI du périphérique";
70
	$l_imei_device = "IMEI du périphérique";
57
	$l_sms_received = "Nombre de SMS reçu";
71
	$l_sms_received = "Nombre de SMS reçu";
58
	$l_stop = "Arrêter";
72
	$l_stop = "Arrêter";
59
	$l_gammu_on="Le service est démarré";
73
	$l_gammu_on="Le service est démarré";
Line 81... Line 95...
81
	$l_country_enable="Activer";
95
	$l_country_enable="Activer";
82
	$l_country_disable="Désactiver";
96
	$l_country_disable="Désactiver";
83
	$l_service_status_img_ok="Démarré";
97
	$l_service_status_img_ok="Démarré";
84
	$l_service_status_img_ko="Arrété";
98
	$l_service_status_img_ko="Arrété";
85
	$l_connect_speed="Modifier la vitesse de connexion : ";
99
	$l_connect_speed="Modifier la vitesse de connexion : ";
86
	$l_connect_port="Modifier le port de connexion : ";
100
	$l_connect_port="Port de connexion";
87
	$l_tab_first = "premier";
101
	$l_tab_first = "premier";
88
	$l_tab_last = "dernier";
102
	$l_tab_last = "dernier";
89
	$l_tab_next = "suivant";
103
	$l_tab_next = "suivant";
90
	$l_tab_prev = "précédent";
104
	$l_tab_prev = "précédent";
91
	$l_tab_search = "Recherche :";
105
	$l_tab_search = "Recherche :";
Line 107... Line 121...
107
	$l_conf = "Configuration";
121
	$l_conf = "Configuration";
108
	$l_conf_actu = "Current configuration";
122
	$l_conf_actu = "Current configuration";
109
	$l_pin = "PIN password";
123
	$l_pin = "PIN password";
110
	$l_num_alcasar = "Phone number of the GSM MODEM";
124
	$l_num_alcasar = "Phone number of the GSM MODEM";
111
	$l_ban_temp = "Max number of try before a permanent ban"; 
125
	$l_ban_temp = "Max number of try before a permanent ban"; 
112
	$l_time_account = "Time for a new session";
126
	$l_time_account = "Validity period of new account";
113
	$l_time_perm = "Duration of a ban (for example, after X try)";
127
	$l_time_perm = "Duration of a ban (for example, after X try)";
114
	$l_status_gammu = "Service status";
128
	$l_status_gammu = "Service status";
115
	$l_start = "Start";
129
	$l_start = "Start";
116
	$l_status_device = "Status of your GSM MODEM (2G/3G/4G key)";
130
	$l_status_device = "Status of your GSM MODEM (2G/3G/4G key)";
117
	$l_key_diseable = "No device detected";
131
	$l_key_diseable = "No device detected";
118
	$l_key_enable_1 = "A GSM MODEM '<b>".$model."</b>' is connected at the speed of ";
132
	$l_key_enable_1 = "A GSM MODEM '<b>".$vendor."(".$model.")</b>' is connected at the speed of ";
119
	$l_key_enable_2 = "It has openned the following ports : ";
133
	$l_key_enable_2 = "It has openned the following ports : ";
120
	$l_key_enable_3 = "ALCASAR manage it actually on port : <b>".$gammu_smsd_port."</b>";
-
 
121
	$l_force_signal = "Signal strength";
134
	$l_force_signal = "Signal strength";
122
	$l_imei_device = "Device IMEI";
135
	$l_imei_device = "Device IMEI";
123
	$l_sms_received = "Number of SMS received";
136
	$l_sms_received = "Number of SMS received";
124
	$l_stop = "Stop";
137
	$l_stop = "Stop";
125
	$l_gammu_on="The service is running";
138
	$l_gammu_on="The service is running";
Line 147... Line 160...
147
	$l_country_enable="Enable";
160
	$l_country_enable="Enable";
148
	$l_country_disable="Disable";
161
	$l_country_disable="Disable";
149
	$l_service_status_img_ok="Running";
162
	$l_service_status_img_ok="Running";
150
	$l_service_status_img_ko="Stopped";
163
	$l_service_status_img_ko="Stopped";
151
	$l_connect_speed="Modify the connection speed : ";
164
	$l_connect_speed="Modify the connection speed : ";
152
	$l_connect_port="Modify the connection port : ";
165
	$l_connect_port="Connection port";
153
	$l_tab_first = "first";
166
	$l_tab_first = "first";
154
	$l_tab_last = "last";
167
	$l_tab_last = "last";
155
	$l_tab_next = "next";
168
	$l_tab_next = "next";
156
	$l_tab_prev = "previous";
169
	$l_tab_prev = "previous";
157
	$l_tab_search = "Search :";
170
	$l_tab_search = "Search :";
Line 224... Line 237...
224
            "info": "<?php echo $l_tab_pmenu; ?>",
237
            "info": "<?php echo $l_tab_pmenu; ?>",
225
            "infoEmpty": "<?php echo $l_tab_infoempty; ?>",
238
            "infoEmpty": "<?php echo $l_tab_infoempty; ?>",
226
			"sSearch": "<?php echo $l_tab_search; ?>"
239
			"sSearch": "<?php echo $l_tab_search; ?>"
227
        }
240
        }
228
	});
241
	});
229
	$(".showhide-div_country").slideUp("slow");	
242
	$(".showhide-div_country").slideUp("slow");
230
	$(".showhide-div_ban").slideUp("slow");
243
	$(".showhide-div_ban").slideUp("slow");
231
	$(".showhide-div_country_plus").slideUp("slow");
244
	$(".showhide-div_country_plus").slideUp("slow");
232
	$(".showhide-but_country").on("click", function(){
245
	$(".showhide-but_country").on("click", function(){
233
	    $(".showhide-div_country").slideToggle("slow");
246
	    $(".showhide-div_country").slideToggle("slow");
234
	});
247
	});
Line 250... Line 263...
250
	</tr>
263
	</tr>
251
	<tr bgcolor=\"#FFCC66\">
264
	<tr bgcolor=\"#FFCC66\">
252
		<td><img src=\"/images/pix.gif\" width=\"1\" height=\"2\"></td>
265
		<td><img src=\"/images/pix.gif\" width=\"1\" height=\"2\"></td>
253
	</tr>
266
	</tr>
254
	</TABLE>
267
	</TABLE>
255
	<br />
268
	<br>
256
	<input type='checkbox' checked='checked' name='autoRefreshCheckboxes' >".$l_autorefresh."
269
	<input type='checkbox' checked='checked' name='autoRefreshCheckboxes' >".$l_autorefresh."
257
	";
270
	";
258
?>
271
?>
259
<center>
272
<center>
260
<br /><br />
273
<br>
261
<form form="GET" action="./autoregistration.php">
274
<form form="GET" action="./autoregistration.php">
262
<table border=1 width=100%>
275
<table border=1 width=100%>
263
<tr>
276
<tr>
264
<td colspan=2><h3><center><?php echo $l_status_device ?></center></h3></td>
277
<td colspan=2><h3><center><?php echo $l_status_device ?></center></h3></td>
265
</tr>
278
</tr>
266
 
-
 
267
<tr>
279
<tr>
268
<?php
280
<?php
269
if($status_key=="true")
281
if($find_key=="true")
270
{
282
{
271
	if(isset($_GET['config_submit'])){
283
	if(isset($_GET['config_submit'])){
272
		switch ($_GET['speed']) {
284
		switch ($_GET['speed']) {
273
		case "at":
285
		case "at":
274
			exec("sudo $script --replace_connect  ");
286
			exec("sudo $script --replace_connect  ");
Line 282... Line 294...
282
		case "115200":
294
		case "115200":
283
			exec("sudo $script --replace_connect 115200");
295
			exec("sudo $script --replace_connect 115200");
284
			break;
296
			break;
285
		}	
297
		}	
286
	}
298
	}
287
	$current_connect = exec("sudo $script --connect");
299
	$current_speed = exec("sudo $script --connect");
288
	echo '<td width="50%">'.$l_key_enable_1."<b>".str_replace("at","",$current_connect).' Bauds</b>';
300
	echo '	<td width="50%">'.$l_key_enable_1."<b>".str_replace("at","",$current_speed).' Bauds</b>';
289
	echo '		<td align="right">	'.$l_connect_speed.'
-
 
290
				<select name="speed">
-
 
291
					<option value="at"></option>
-
 
292
					<option value="9600">9600 Bauds</option>
-
 
293
					<option value="19200">19200 Bauds</option>
-
 
294
					<option value="115200">115200 Bauds</option>
-
 
295
				</select>
-
 
296
				<input type="submit" name="config_submit"> 
-
 
297
			</td></tr>';
-
 
298
	echo '<tr><td width="50%">'.$l_key_enable_2.'<b>';
-
 
299
	while ( list(,$row) = each($openned_ports))
-
 
300
	{
-
 
301
		echo $row." ";
-
 
302
	}
-
 
303
	echo '</b><br>'.$l_key_enable_3.'</td>';
301
	echo '<br>'.$l_key_enable_2.'<b>';
304
	echo '		<td align="right">	'.$l_connect_port.'
-
 
305
				<select name="port">';
-
 
306
	reset ($openned_ports);
302
	reset ($openned_ports);
307
	while ( list(,$row) = each($openned_ports))
303
	while ( list(,$row) = each($openned_ports))
308
	{
304
	{
309
		echo '<option value="'.$row.'">'.$row.'</option>';
-
 
310
		echo $row." ";
305
		echo $row." ";
311
	}
306
	}
-
 
307
	echo '</b></td>';
-
 
308
	echo '
-
 
309
	<td align="right">	'.$l_connect_speed.'
-
 
310
			<select name="speed">
-
 
311
				<option value="at"></option>
-
 
312
				<option value="9600">9600 Bauds</option>
-
 
313
				<option value="19200">19200 Bauds</option>
-
 
314
				<option value="115200">115200 Bauds</option>
312
	echo '			</select>
315
			</select>
313
				<input type="submit" name="config_submit"> 
316
			<input type="submit" name="config_submit">
314
			</td>';
317
	</td>';
315
}
318
}
316
else
319
else
317
{
320
{
318
	echo "<td>$l_key_diseable</td>";
321
	echo "<td>$l_key_diseable</td>";
319
}
322
}
320
?>
323
?>
321
</tr>
324
</tr>
322
</table>
325
</table>
323
</form>
326
</form>
324
</center>
327
</center>
325
<br /><br />
328
<br>
326
 
-
 
327
<?php
329
<?php
328
 
330
 
329
#Test if gammu is started
-
 
330
$gammu_pid=exec("sudo $script --pidof");
-
 
331
if ($status_key=="false")
-
 
332
{
-
 
333
	if ($gammu_pid!="")
-
 
334
	{
-
 
335
		exec("sudo $script stop");
-
 
336
		sleep(8);
-
 
337
		header('Location: autoregistration.php');
-
 
338
		exit();
-
 
339
	}
-
 
340
}
-
 
341
 
-
 
342
if ($status_key=="true")
331
if ($find_key=="true")
343
{
332
{
344
	#Nom du fichier de log lorsque gammu est démarré
333
	#Nom du fichier de log lorsque gammu est démarré
345
	#$file_log = "gammu-smsd.log";
334
	#$file_log = "gammu-smsd.log";
346
 
335
 
347
	#Recuperation du code PIN actuel
336
	#Recuperation du code PIN actuel
348
	$current_pin = exec("sudo $script --pin");	
337
	$current_pin = exec("sudo $script --pin");	
349
	
338
	
350
	#Recuperation du nombre de try avant le ban perm
339
	#Recuperation du nombre de try avant le ban perm
351
	$current_try_ban = exec("sudo $script --try_ban");	
340
	$current_try_ban = exec("sudo $script --try_ban");
352
 
341
 
353
	#Recuperation de la durée d'une session créée
342
	#Recuperation de la durée d'une session créée
354
	$current_time_account = exec("sudo $script --time_account");	
343
	$current_time_account = exec("sudo $script --time_account");
355
 
344
 
356
	#Recuperation de la durée dun ban perm (après flood)
345
	#Recuperation de la durée dun ban perm (après flood)
357
	$current_time_perm = exec("sudo $script --time_perm");	
346
	$current_time_perm = exec("sudo $script --time_perm");
358
 
347
 
359
	#Detection neméro de tel
348
	#Detection neméro de tel
360
	$current_num_alcasar = exec("sudo $script --numero_alcasar");
349
	$current_num_alcasar = exec("sudo $script --numero_alcasar");
361
	
350
	
362
	#Detection problème avec la SIM
351
	#Detection problème avec la SIM
Line 382... Line 371...
382
	{
371
	{
383
		$force_signal = "-";
372
		$force_signal = "-";
384
		$imei_device = "-";
373
		$imei_device = "-";
385
		$sms_received = "-";
374
		$sms_received = "-";
386
 
375
 
387
		$gammu="<td><img src=\"/images/state_error.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ko."\"></td><td>$l_gammu_off</td>";	
376
		$gammu="<td><img src=\"/images/state_error.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ko."\"></td><td>$l_gammu_off</td>";
388
		$gammu_status_on="";
377
		$gammu_status_on="";
389
		$gammu_status_off="disabled";
378
		$gammu_status_off="disabled";
390
 
379
 
391
		if($current_last_secu!="")
380
		if($current_last_secu!="")
392
		{
381
		{
393
			if(($current_last_secu > $current_last_start) && ($current_last_secu < $current_last_stop))
382
			if(($current_last_secu > $current_last_start) && ($current_last_secu < $current_last_stop))
394
			{
383
			{
395
				$gammu_simsecu="<tr><td colspan=7><font color=red>$l_error_simsecu_l</font></td></tr>";	
384
				$gammu_simsecu="<tr><td colspan=7><font color=red>$l_error_simsecu_l</font></td></tr>";
396
			}
385
			}
397
		}
386
		}
398
	} else {
387
	} else {
399
		# Recuperation de la force du signal et IMEI et nombre de sms reçu
388
		# Recuperation de la force du signal et IMEI et nombre de sms reçu
400
		$val_force_signal = exec("sudo $script --signal_device");
389
		$val_force_signal = exec("sudo $script --signal_device");
Line 415... Line 404...
415
		} elseif ($val_force_signal < 101) {
404
		} elseif ($val_force_signal < 101) {
416
			$force_signal = "<img src=\"/images/signal_80.png\">  --  ".$val_force_signal." %";
405
			$force_signal = "<img src=\"/images/signal_80.png\">  --  ".$val_force_signal." %";
417
 
406
 
418
		}
407
		}
419
 
408
 
420
 
-
 
421
 
-
 
422
 
-
 
423
 
-
 
424
		$gammu="<td><img src=\"/images/state_ok.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ok."\"></td><td>$l_gammu_on</td>";	
409
		$gammu="<td><img src=\"/images/state_ok.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ok."\"></td><td>$l_gammu_on</td>";
425
				
-
 
426
		
-
 
427
		if($current_last_timeout!=""){
410
		if($current_last_timeout!=""){
428
			if(($current_last_timeout > $current_last_start) && ($current_last_timeout > $current_last_stop))
411
			if(($current_last_timeout > $current_last_start) && ($current_last_timeout > $current_last_stop))
429
			{
412
			{
430
				$gammu_timeout="<tr><td colspan=7><font color=red>$l_error_timeoutfail</font></td></tr>";	
413
				$gammu_timeout="<tr><td colspan=7><font color=red>$l_error_timeoutfail</font></td></tr>";
431
			}
414
			}
432
		}
415
		}
433
		
416
		
434
		if($current_last_secu!="")
417
		if($current_last_secu!="")
435
		{
418
		{
Line 440... Line 423...
440
		}
423
		}
441
		
424
		
442
		if($current_last_write!=""){
425
		if($current_last_write!=""){
443
			if(($current_last_write > $current_last_start) && ($current_last_write > $current_last_stop))
426
			if(($current_last_write > $current_last_start) && ($current_last_write > $current_last_stop))
444
			{
427
			{
445
				$gammu_writeerror="<tr><td colspan=7><font color=red>$l_error_writefail</font></td></tr>";	
428
				$gammu_writeerror="<tr><td colspan=7><font color=red>$l_error_writefail</font></td></tr>";
446
			}
429
			}
447
		}
430
		}
448
		
431
		
449
		if($current_simfail!="")
432
		if($current_simfail!="")
450
		{
433
		{
Line 460... Line 443...
460
 
443
 
461
	#Lancement et arret de gammu-smsd 3*7sec
444
	#Lancement et arret de gammu-smsd 3*7sec
462
	if(isset($_GET["start"])){
445
	if(isset($_GET["start"])){
463
		$gammu_1=exec("sudo $script --start");
446
		$gammu_1=exec("sudo $script --start");
464
		sleep(7);
447
		sleep(7);
465
		
-
 
466
		if($current_last_secu!="")
448
		if($current_last_secu!="")
467
		{
449
		{
468
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
450
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
469
			{
451
			{
470
				exec("sudo $script --stop");
452
				exec("sudo $script --stop");
471
			}
453
			}
472
		}
454
		}
473
		
-
 
474
		sleep(7);
455
		sleep(7);
475
		if($current_last_secu!="")
456
		if($current_last_secu!="")
476
		{
457
		{
477
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
458
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
478
			{
459
			{
479
				exec("sudo $script --stop");
460
				exec("sudo $script --stop");
480
			}
461
			}
481
		}
462
		}
482
		
-
 
483
		sleep(7);	
463
		sleep(7);	
484
		if($current_last_secu!="")
464
		if($current_last_secu!="")
485
		{
465
		{
486
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
466
			if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
487
			{
467
			{
488
				exec("sudo $script --stop");
468
				exec("sudo $script --stop");
489
			}
469
			}
490
		}
470
		}
491
		
-
 
492
		
-
 
493
		
-
 
494
		header('Location: autoregistration.php');
471
		header('Location: autoregistration.php');
495
		exit();
472
		exit();
496
	}
473
	}
497
 
474
 
498
	if(isset($_GET["stop"])){
475
	if(isset($_GET["stop"])){
Line 538... Line 515...
538
				header('Location: autoregistration.php');
515
				header('Location: autoregistration.php');
539
				exit();
516
				exit();
540
			}
517
			}
541
			else
518
			else
542
			{
519
			{
543
				$error_pin=$l_error_label_num;			
520
				$error_pin=$l_error_label_num;
544
			}
521
			}
545
		}
522
		}
546
		else
523
		else
547
		{
524
		{
548
			$error_pin=$l_error_label_empty;
525
			$error_pin=$l_error_label_empty;
Line 662... Line 639...
662
		header('Location: autoregistration.php');
639
		header('Location: autoregistration.php');
663
		exit();
640
		exit();
664
	}
641
	}
665
 
642
 
666
	if(isset($_GET["b_country_enable"])){
643
	if(isset($_GET["b_country_enable"])){
667
		exec("sudo $script --change_country_ena_all");		
644
		exec("sudo $script --change_country_ena_all");
668
		exec("sudo $script --change_country_filter all");
645
		exec("sudo $script --change_country_filter all");
669
		header('Location: autoregistration.php');
646
		header('Location: autoregistration.php');
670
		exit();
647
		exit();
671
	}
648
	}
672
 
649
 
673
	if(isset($_GET["b_country_disable"])){
650
	if(isset($_GET["b_country_disable"])){
674
		exec("sudo $script --change_country_dis_all");
651
		exec("sudo $script --change_country_dis_all");
675
		header('Location: autoregistration.php');
652
		header('Location: autoregistration.php');
676
		exit();
653
		exit();
677
	}
654
	}
678
 
-
 
679
 
655
	
680
	#Si une clé 3g est plugué
-
 
681
	echo "<form action=\"autoregistration.php\" methode=\"GET\">
656
	echo "<form action=\"autoregistration.php\" methode=\"GET\">
682
			
-
 
683
		<table border=1>
-
 
684
		<tr>
-
 
685
			<td colspan=4><b>$l_status_gammu</b></td>
-
 
686
			<td><b><center>$l_force_signal</center></b></td>
-
 
687
			<td><b><center>$l_imei_device</center></b></td> 
-
 
688
			<td><b><center>$l_sms_received</center></b></td> 
-
 
689
		</tr>
-
 
690
		<tr>
-
 
691
			$gammu
-
 
692
			<td><button type=\"submit\" name=\"start\" $gammu_status_on>$l_start</button></td>		
-
 
693
			<td><button type=\"submit\" name=\"stop\" $gammu_status_off>$l_stop</button></td>
-
 
694
			<td><center>$force_signal</center></td>
-
 
695
			<td><center>$imei_device</center></td>
-
 
696
			<td><center>$sms_received</center></td>
-
 
697
		</tr>
-
 
698
		$gammu_puk
-
 
699
		$gammu_simfail
-
 
700
		$gammu_simsecu
-
 
701
		$gammu_timeout
-
 
702
		$gammu_writeerror
-
 
703
		</table>
-
 
704
	<br /><br />
-
 
705
		
-
 
706
		<table border=1>
657
		<table border=1>
707
		<tr>
658
		<tr>
708
		<td colspan=3><b>$l_conf</b></td>
659
		<td colspan=3><b>$l_conf</b></td>
709
		<td><b>$l_conf_actu</b></td>
660
		<td><b>$l_conf_actu</b></td>
710
		</tr>
661
		</tr>
-
 
662
		<tr>
-
 
663
		<td> $l_connect_port </td><td><select name=\"port\">'";
-
 
664
		reset ($openned_ports);
-
 
665
		while ( list(,$row) = each($openned_ports))
-
 
666
		{
-
 
667
			echo '<option value="'.$row.'">'.$row.'</option>';
-
 
668
			echo $row." ";
711
		
669
		}
-
 
670
	echo "</select></td>
-
 
671
		<td><button type=\"submit\" name=\"b_num_alcasar\" $gammu_status_on>$l_edit</button></td>
-
 
672
		<td><center><font color=\"green\">$gammu_smsd_port</font></center></td>
-
 
673
		</tr>
712
		<tr>
674
		<tr>
713
		<td> $l_num_alcasar </td><td><input type=text name='num_alcasar' maxlength=\"20\"></td>
675
		<td> $l_num_alcasar </td><td><input type=text name='num_alcasar' maxlength=\"20\"></td>
714
		<td><button type=\"submit\" name=\"b_num_alcasar\" $gammu_status_on>$l_edit</button></td>
676
		<td><button type=\"submit\" name=\"b_num_alcasar\" $gammu_status_on>$l_edit</button></td>
715
		<td><center><font color=\"green\">$current_num_alcasar</font></center></td>
677
		<td><center><font color=\"green\">$current_num_alcasar</font></center></td>
716
		</tr>
678
		</tr>
717
		<tr><td colspan=\"4\"><font color=red><b>$error_num_alcasar</b></font></td></tr>
679
		<tr><td colspan=\"4\"><font color=red><b>$error_num_alcasar</b></font></td></tr>
718
		
-
 
719
		<tr>		
680
		<tr>		
720
		<td> $l_pin </td><td><input type=text name='pin' maxlength=\"8\"></td>
681
		<td> $l_pin </td><td><input type=text name='pin' maxlength=\"8\"></td>
721
		<td><button type=\"submit\" name=\"b_pin\" $gammu_status_on>$l_edit</button></td>
682
		<td><button type=\"submit\" name=\"b_pin\" $gammu_status_on>$l_edit</button></td>
722
		<td><center><font color=\"green\">$current_pin</font></center></td>
683
		<td><center><font color=\"green\">$current_pin</font></center></td>
723
		</tr>
684
		</tr>
724
		<tr><td colspan=\"4\"><font color=red><b>$error_pin</b></font></td></tr>
685
		<tr><td colspan=\"4\"><font color=red><b>$error_pin</b></font></td></tr>
725
		
-
 
726
		<tr>
686
		<tr>
727
		<td> $l_time_account </td><td><input type=text name='time_account'> $l_days </td>
687
		<td> $l_time_account </td><td><input type=text name='time_account'> $l_days </td>
728
		<td><button type=\"submit\" name=\"b_time_account\" $gammu_status_on>$l_edit</button></td>	
688
		<td><button type=\"submit\" name=\"b_time_account\" $gammu_status_on>$l_edit</button></td>
729
		<td><center><font color=\"blue\">$current_time_account</font></center></td>
689
		<td><center><font color=\"blue\">$current_time_account</font></center></td>
730
		</tr>
690
		</tr>
731
		<tr><td colspan=\"4\"><font color=red><b>$error_time_account</b></font></td></tr>
691
		<tr><td colspan=\"4\"><font color=red><b>$error_time_account</b></font></td></tr>
732
		
-
 
733
		<tr>
692
		<tr>
734
		<td> $l_ban_temp </td><td><input type=text name='nb_essais'></td>	
693
		<td> $l_ban_temp </td><td><input type=text name='nb_essais'></td>
735
		<td><button type=\"submit\" name=\"b_ban_temp\" $gammu_status_on>$l_edit</button></td>	
694
		<td><button type=\"submit\" name=\"b_ban_temp\" $gammu_status_on>$l_edit</button></td>
736
		<td><center><font color=\"orange\">$current_try_ban</font></center></td>
695
		<td><center><font color=\"orange\">$current_try_ban</font></center></td>
737
		</tr>
696
		</tr>
738
		<tr><td colspan=\"4\"><font color=red><b>$error_nb_essais</b></font></td></tr>
697
		<tr><td colspan=\"4\"><font color=red><b>$error_nb_essais</b></font></td></tr>
739
		
-
 
740
		<tr>
698
		<tr>
741
		<td>$l_time_perm</td><td><input type=text name='time_perm'> $l_days</td>
699
		<td>$l_time_perm</td><td><input type=text name='time_perm'> $l_days</td>
742
		<td><button type=\"submit\" name=\"b_time_perm\" $gammu_status_on>$l_edit</button></td>	
700
		<td><button type=\"submit\" name=\"b_time_perm\" $gammu_status_on>$l_edit</button></td>
743
		<td><center><font color=\"orange\">$current_time_perm</font></center></td>
701
		<td><center><font color=\"orange\">$current_time_perm</font></center></td>
744
		</tr>
702
		</tr>
745
		<tr><td colspan=\"4\"><font color=red><b>$error_time_perm</b></font></td></tr>
703
		<tr><td colspan=\"4\"><font color=red><b>$error_time_perm</b></font></td></tr>
746
		</table>
704
		</table>
-
 
705
		<br>
-
 
706
		<table border=1>
-
 
707
		<tr>
-
 
708
			<td colspan=4><b>$l_status_gammu</b></td>
-
 
709
			<td><b><center>$l_force_signal</center></b></td>
-
 
710
			<td><b><center>$l_imei_device</center></b></td>
-
 
711
			<td><b><center>$l_sms_received</center></b></td>
-
 
712
		</tr>
-
 
713
		<tr>
-
 
714
			$gammu
-
 
715
			<td><button type=\"submit\" name=\"start\" $gammu_status_on>$l_start</button></td>
-
 
716
			<td><button type=\"submit\" name=\"stop\" $gammu_status_off>$l_stop</button></td>
-
 
717
			<td><center>$force_signal</center></td>
-
 
718
			<td><center>$imei_device</center></td>
-
 
719
			<td><center>$sms_received</center></td>
-
 
720
		</tr>
-
 
721
		$gammu_puk
-
 
722
		$gammu_simfail
-
 
723
		$gammu_simsecu
-
 
724
		$gammu_timeout
-
 
725
		$gammu_writeerror
-
 
726
		</table>
747
		</form>";
727
		</form>";
748
 
-
 
749
	
728
	
750
	require('/etc/freeradius-web/config.php');
729
	require('/etc/freeradius-web/config.php');
751
 
730
 
752
	if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
731
	if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
753
		include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
732
		include_once("../lib/sql/drivers/$config[sql_type]/functions.php");