Subversion Repositories ALCASAR

Rev

Rev 1349 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

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