Subversion Repositories ALCASAR

Rev

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

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