Subversion Repositories ALCASAR

Rev

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

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