Subversion Repositories ALCASAR

Rev

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

Rev 2317 Rev 2349
1
<?php
1
<?php
2
# $Id: autoregistration.php 2317 2017-06-30 11:42:44Z tom.houdayer $
2
# $Id: autoregistration.php 2349 2017-07-22 12:20:21Z 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.min.js"></script>
167
<script type="text/javascript" charset="utf8" src="/js/jquery.min.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
		exit();
310
	}
310
	}
311
}
311
}
312
 
312
 
313
if ($status_key=="true")
313
if ($status_key=="true")
314
{
314
{
315
	#Nom du fichier de log lorsque gammu est démarré
315
	#Nom du fichier de log lorsque gammu est démarré
316
	#$file_log = "gammu-smsd.log";
316
	#$file_log = "gammu-smsd.log";
317
 
317
 
318
	#Recuperation du code PIN actuel
318
	#Recuperation du code PIN actuel
319
	$current_pin = exec("sudo $script --pin");	
319
	$current_pin = exec("sudo $script --pin");	
320
	
320
	
321
	#Recuperation du nombre de try avant le ban perm
321
	#Recuperation du nombre de try avant le ban perm
322
	$current_try_ban = exec("sudo $script --try_ban");	
322
	$current_try_ban = exec("sudo $script --try_ban");	
323
 
323
 
324
	#Recuperation de la durée d'une session créée
324
	#Recuperation de la durée d'une session créée
325
	$current_time_account = exec("sudo $script --time_account");	
325
	$current_time_account = exec("sudo $script --time_account");	
326
 
326
 
327
	#Recuperation de la durée dun ban perm (après flood)
327
	#Recuperation de la durée dun ban perm (après flood)
328
	$current_time_perm = exec("sudo $script --time_perm");	
328
	$current_time_perm = exec("sudo $script --time_perm");	
329
 
329
 
330
	#Detection neméro de tel
330
	#Detection neméro de tel
331
	$current_num_alcasar = exec("sudo $script --numero_alcasar");
331
	$current_num_alcasar = exec("sudo $script --numero_alcasar");
332
	
332
	
333
	#Detection problème avec la SIM
333
	#Detection problème avec la SIM
334
	$current_simfail = exec("sudo $script --last_nosim");
334
	$current_simfail = exec("sudo $script --last_nosim");
335
 
335
 
336
	#Recuperation de la dernière ligne de START
336
	#Recuperation de la dernière ligne de START
337
	$current_last_start = exec("sudo $script --last_start");
337
	$current_last_start = exec("sudo $script --last_start");
338
 
338
 
339
	#Recuperarion de la dernière ligne de STOP
339
	#Recuperarion de la dernière ligne de STOP
340
	$current_last_stop = exec("sudo $script --last_stop");
340
	$current_last_stop = exec("sudo $script --last_stop");
341
 
341
 
342
	#Recuperation de la dernière ligne de SECURITYERROR
342
	#Recuperation de la dernière ligne de SECURITYERROR
343
	$current_last_secu = exec("sudo $script --last_secu");
343
	$current_last_secu = exec("sudo $script --last_secu");
344
 
344
 
345
	#Recuperation de la dernière ligne de DEVICEWRITEERROR
345
	#Recuperation de la dernière ligne de DEVICEWRITEERROR
346
	$current_last_write = exec("sudo $script --last_writeerror");
346
	$current_last_write = exec("sudo $script --last_writeerror");
347
 
347
 
348
	#Recuperation de la dernière ligne de TIMEOUT
348
	#Recuperation de la dernière ligne de TIMEOUT
349
	$current_last_timeout = exec("sudo $script --last_timeout");
349
	$current_last_timeout = exec("sudo $script --last_timeout");
350
	
350
	
351
	# Test si le service est lancé
351
	# Test si le service est lancé
352
	if ($gammu_pid=="")
352
	if ($gammu_pid=="")
353
	{
353
	{
354
		$force_signal = "-";
354
		$force_signal = "-";
355
		$imei_device = "-";
355
		$imei_device = "-";
356
		$sms_received = "-";
356
		$sms_received = "-";
357
 
357
 
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="<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="";
359
		$gammu_status_on="";
360
		$gammu_status_off="disabled";
360
		$gammu_status_off="disabled";
361
 
361
 
362
		if($current_last_secu!="")
362
		if($current_last_secu!="")
363
		{
363
		{
364
			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))
365
			{
365
			{
366
				$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>";	
367
			}
367
			}
368
		}
368
		}
369
	} else {
369
	} else {
370
		# 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
371
		$val_force_signal = exec("sudo $script --signal_device");
371
		$val_force_signal = exec("sudo $script --signal_device");
372
		$imei_device = exec("sudo $script --imei_device");
372
		$imei_device = exec("sudo $script --imei_device");
373
		$sms_received = exec("sudo $script --sms_received");
373
		$sms_received = exec("sudo $script --sms_received");
374
 
374
 
375
		if ($val_force_signal < 21) {
375
		if ($val_force_signal < 21) {
376
			$force_signal = "<img src=\"/images/signal_0.png\">  --  ".$val_force_signal." %";
376
			$force_signal = "<img src=\"/images/signal_0.png\">  --  ".$val_force_signal." %";
377
		} elseif ($val_force_signal < 41) {
377
		} elseif ($val_force_signal < 41) {
378
			$force_signal = "<img src=\"/images/signal_20.png\">  --  ".$val_force_signal." %";
378
			$force_signal = "<img src=\"/images/signal_20.png\">  --  ".$val_force_signal." %";
379
 
379
 
380
		} elseif ($val_force_signal < 61) {
380
		} elseif ($val_force_signal < 61) {
381
			$force_signal = "<img src=\"/images/signal_40.png\">  --  ".$val_force_signal." %";
381
			$force_signal = "<img src=\"/images/signal_40.png\">  --  ".$val_force_signal." %";
382
 
382
 
383
		} elseif ($val_force_signal < 81) {
383
		} elseif ($val_force_signal < 81) {
384
			$force_signal = "<img src=\"/images/signal_60.png\">  --  ".$val_force_signal." %";
384
			$force_signal = "<img src=\"/images/signal_60.png\">  --  ".$val_force_signal." %";
385
 
385
 
386
		} elseif ($val_force_signal < 101) {
386
		} elseif ($val_force_signal < 101) {
387
			$force_signal = "<img src=\"/images/signal_80.png\">  --  ".$val_force_signal." %";
387
			$force_signal = "<img src=\"/images/signal_80.png\">  --  ".$val_force_signal." %";
388
 
388
 
389
		}
389
		}
390
 
390
 
391
 
391
 
392
 
392
 
393
 
393
 
394
 
394
 
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
		$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
				
396
				
397
		
397
		
398
		if($current_last_timeout!=""){
398
		if($current_last_timeout!=""){
399
			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))
400
			{
400
			{
401
				$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>";	
402
			}
402
			}
403
		}
403
		}
404
		
404
		
405
		if($current_last_secu!="")
405
		if($current_last_secu!="")
406
		{
406
		{
407
			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))
408
			{
408
			{
409
				exec("sudo $script --stop");
409
				exec("sudo $script --stop");
410
			}
410
			}
411
		}
411
		}
412
		
412
		
413
		if($current_last_write!=""){
413
		if($current_last_write!=""){
414
			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))
415
			{
415
			{
416
				$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>";	
417
			}
417
			}
418
		}
418
		}
419
		
419
		
420
		if($current_simfail!="")
420
		if($current_simfail!="")
421
		{
421
		{
422
			if(($current_simfail > $current_last_start) && ($current_simfail > $current_last_stop))
422
			if(($current_simfail > $current_last_start) && ($current_simfail > $current_last_stop))
423
			{
423
			{
424
				$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>";
425
			}
425
			}
426
		}
426
		}
427
		$gammu_status_on="disabled";
427
		$gammu_status_on="disabled";
428
		$gammu_status_off="";
428
		$gammu_status_off="";
429
	}
429
	}
430
 
430
 
431
 
431
 
432
	#Lancement et arret de gammu-smsd 3*7sec
432
	#Lancement et arret de gammu-smsd 3*7sec
433
	if(isset($_GET["start"])){
433
	if(isset($_GET["start"])){
434
		$gammu_1=exec("sudo $script --start");
434
		$gammu_1=exec("sudo $script --start");
435
		sleep(7);
435
		sleep(7);
436
		
436
		
437
		if($current_last_secu!="")
437
		if($current_last_secu!="")
438
		{
438
		{
439
			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))
440
			{
440
			{
441
				exec("sudo $script --stop");
441
				exec("sudo $script --stop");
442
			}
442
			}
443
		}
443
		}
444
		
444
		
445
		sleep(7);
445
		sleep(7);
446
		if($current_last_secu!="")
446
		if($current_last_secu!="")
447
		{
447
		{
448
			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))
449
			{
449
			{
450
				exec("sudo $script --stop");
450
				exec("sudo $script --stop");
451
			}
451
			}
452
		}
452
		}
453
		
453
		
454
		sleep(7);	
454
		sleep(7);	
455
		if($current_last_secu!="")
455
		if($current_last_secu!="")
456
		{
456
		{
457
			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))
458
			{
458
			{
459
				exec("sudo $script --stop");
459
				exec("sudo $script --stop");
460
			}
460
			}
461
		}
461
		}
462
		
462
		
463
		
463
		
464
		
464
		
465
		header('Location: autoregistration.php');
465
		header('Location: autoregistration.php');
466
		exit();
466
		exit();
467
	}
467
	}
468
 
468
 
469
	if(isset($_GET["stop"])){
469
	if(isset($_GET["stop"])){
470
		exec("sudo $script --stop");
470
		exec("sudo $script --stop");
471
		sleep(8);
471
		sleep(8);
472
		header('Location: autoregistration.php');
472
		header('Location: autoregistration.php');
473
		exit();
473
		exit();
474
	}
474
	}
475
 
475
 
476
 
476
 
477
	#Edition du NUMERO de telephone
477
	#Edition du NUMERO de telephone
478
	if(isset($_GET["b_num_alcasar"])){
478
	if(isset($_GET["b_num_alcasar"])){
479
		$num = $_GET["num_alcasar"];
479
		$num = $_GET["num_alcasar"];
480
		$error_num_alcasar = "";
480
		$error_num_alcasar = "";
481
		if($num !="")
481
		if($num !="")
482
		{
482
		{
483
			if(preg_match('#^\+#',$num))
483
			if(preg_match('#^\+#',$num))
484
			{
484
			{
485
				exec("sudo $script --replace_numero_alcasar ".escapeshellarg($num));
485
				exec("sudo $script --replace_numero_alcasar ".escapeshellarg($num));
486
				header('Location: autoregistration.php');
486
				header('Location: autoregistration.php');
487
				exit();
487
				exit();
488
			}
488
			}
489
			else
489
			else
490
			{
490
			{
491
				$error_num_alcasar=$l_error_label_num3;
491
				$error_num_alcasar=$l_error_label_num3;
492
			}
492
			}
493
		}
493
		}
494
		else
494
		else
495
		{
495
		{
496
			$error_num_alcasar=$l_error_label_empty;
496
			$error_num_alcasar=$l_error_label_empty;
497
		}
497
		}
498
	}
498
	}
499
	
499
	
500
	#Edition du code PIN
500
	#Edition du code PIN
501
	if(isset($_GET["b_pin"])){
501
	if(isset($_GET["b_pin"])){
502
		$pin = $_GET["pin"];
502
		$pin = $_GET["pin"];
503
		$error_pin = "";
503
		$error_pin = "";
504
		if($pin !="")
504
		if($pin !="")
505
		{
505
		{
506
			if(is_numeric($pin))
506
			if(is_numeric($pin))
507
			{
507
			{
508
				exec("sudo $script --replace_pin ".escapeshellarg($pin));
508
				exec("sudo $script --replace_pin ".escapeshellarg($pin));
509
				header('Location: autoregistration.php');
509
				header('Location: autoregistration.php');
510
				exit();
510
				exit();
511
			}
511
			}
512
			else
512
			else
513
			{
513
			{
514
				$error_pin=$l_error_label_num;			
514
				$error_pin=$l_error_label_num;			
515
			}
515
			}
516
		}
516
		}
517
		else
517
		else
518
		{
518
		{
519
			$error_pin=$l_error_label_empty;
519
			$error_pin=$l_error_label_empty;
520
		}
520
		}
521
	}
521
	}
522
	
522
	
523
	
523
	
524
	#Edition du nombre d'essais avant le ban perm
524
	#Edition du nombre d'essais avant le ban perm
525
	if(isset($_GET["b_ban_temp"])){
525
	if(isset($_GET["b_ban_temp"])){
526
		$nb_ban_temp = $_GET["nb_essais"];
526
		$nb_ban_temp = $_GET["nb_essais"];
527
		$error_nb_essais = "";
527
		$error_nb_essais = "";
528
		if($nb_ban_temp !="")
528
		if($nb_ban_temp !="")
529
		{
529
		{
530
			if(is_numeric($nb_ban_temp))
530
			if(is_numeric($nb_ban_temp))
531
			{
531
			{
532
				exec("sudo $script --replace_try_ban ".escapeshellarg($nb_ban_temp));
532
				exec("sudo $script --replace_try_ban ".escapeshellarg($nb_ban_temp));
533
				header('Location: autoregistration.php');
533
				header('Location: autoregistration.php');
534
				exit();
534
				exit();
535
			}
535
			}
536
			else
536
			else
537
			{
537
			{
538
				$error_nb_essais=$l_error_label_num2;			
538
				$error_nb_essais=$l_error_label_num2;			
539
			}
539
			}
540
		}
540
		}
541
		else
541
		else
542
		{
542
		{
543
			$error_nb_essais=$l_error_label_empty;
543
			$error_nb_essais=$l_error_label_empty;
544
		}
544
		}
545
	}
545
	}
546
 
546
 
547
 
547
 
548
	#Edition de la durée pour un compte créé
548
	#Edition de la durée pour un compte créé
549
	if(isset($_GET["b_time_account"])){
549
	if(isset($_GET["b_time_account"])){
550
		$time_account = $_GET["time_account"];
550
		$time_account = $_GET["time_account"];
551
		$error_time_account = "";
551
		$error_time_account = "";
552
		if($time_account !="")
552
		if($time_account !="")
553
		{
553
		{
554
			if(is_numeric($time_account))
554
			if(is_numeric($time_account))
555
			{
555
			{
556
				exec("sudo $script --replace_time_account ".escapeshellarg($time_account));
556
				exec("sudo $script --replace_time_account ".escapeshellarg($time_account));
557
				header('Location: autoregistration.php');
557
				header('Location: autoregistration.php');
558
				exit();
558
				exit();
559
			}
559
			}
560
			else
560
			else
561
			{
561
			{
562
				$error_time_account=$l_error_label_num2;
562
				$error_time_account=$l_error_label_num2;
563
			}
563
			}
564
		}
564
		}
565
		else
565
		else
566
		{
566
		{
567
			$error_time_account=$l_error_label_empty;
567
			$error_time_account=$l_error_label_empty;
568
		}
568
		}
569
	}
569
	}
570
 
570
 
571
	#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)
572
	if(isset($_GET["b_time_perm"])){
572
	if(isset($_GET["b_time_perm"])){
573
		$time_perm = $_GET["time_perm"];
573
		$time_perm = $_GET["time_perm"];
574
		$error_time_perm = "";
574
		$error_time_perm = "";
575
		if($time_perm !="")
575
		if($time_perm !="")
576
		{
576
		{
577
			if(is_numeric($time_perm))
577
			if(is_numeric($time_perm))
578
			{
578
			{
579
				exec("sudo $script --replace_time_perm ".escapeshellarg($time_perm));
579
				exec("sudo $script --replace_time_perm ".escapeshellarg($time_perm));
580
				header('Location: autoregistration.php');
580
				header('Location: autoregistration.php');
581
				exit();
581
				exit();
582
			}
582
			}
583
			else
583
			else
584
			{
584
			{
585
				$error_time_perm=$l_error_label_num2;
585
				$error_time_perm=$l_error_label_num2;
586
			}
586
			}
587
		}
587
		}
588
		else
588
		else
589
		{
589
		{
590
			$error_time_perm=$l_error_label_empty;
590
			$error_time_perm=$l_error_label_empty;
591
		}
591
		}
592
	}
592
	}
593
 
593
 
594
	# Suppression d'un numero bloqué
594
	# Suppression d'un numero bloqué
595
	if(isset($_GET['num_select'])){
595
	if(isset($_GET['num_select'])){
596
		$numero=$_GET['num_select'];
596
		$numero=$_GET['num_select'];
597
 
597
 
598
		$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");
-
 
599
		if (!empty($add_mac)) {
599
		exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($add_mac));
600
			exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($add_mac));
-
 
601
		}
600
 
602
 
601
		exec("sudo $script --unlock_num $numero");
603
		exec("sudo $script --unlock_num $numero");
602
		header('Location: autoregistration.php');
604
		header('Location: autoregistration.php');
603
		exit();
605
		exit();
604
	}
606
	}
605
 
607
 
606
	# Edition etat pays
608
	# Edition etat pays
607
	if(isset($_GET['country_select'])){
609
	if(isset($_GET['country_select'])){
608
		$country=utf8_decode($_GET['country_select']);
610
		$country=utf8_decode($_GET['country_select']);
609
		exec("sudo $script --change_country ".escapeshellarg($country));
611
		exec("sudo $script --change_country ".escapeshellarg($country));
610
		exec("sudo $script --change_country_filter advance");
612
		exec("sudo $script --change_country_filter advance");
611
		header('Location: autoregistration.php');
613
		header('Location: autoregistration.php');
612
		exit();
614
		exit();
613
	}
615
	}
614
 
616
 
615
	if(isset($_GET['b_france_enable'])){
617
	if(isset($_GET['b_france_enable'])){
616
		exec("sudo $script --change_country_dis_all");
618
		exec("sudo $script --change_country_dis_all");
617
		exec("sudo $script --change_country France");
619
		exec("sudo $script --change_country France");
618
		exec("sudo $script --change_country_filter fr");
620
		exec("sudo $script --change_country_filter fr");
619
		header('Location: autoregistration.php');
621
		header('Location: autoregistration.php');
620
		exit();
622
		exit();
621
	}
623
	}
622
 
624
 
623
	if(isset($_GET['b_ue_enable'])){
625
	if(isset($_GET['b_ue_enable'])){
624
		exec("sudo $script --change_country_dis_all");
626
		exec("sudo $script --change_country_dis_all");
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");
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");
626
		foreach ($array_ue as $pays){
628
		foreach ($array_ue as $pays){
627
			exec("sudo $script --change_country ".escapeshellarg($pays));
629
			exec("sudo $script --change_country ".escapeshellarg($pays));
628
		}
630
		}
629
		
631
		
630
		exec("sudo $script --change_country_filter ue");
632
		exec("sudo $script --change_country_filter ue");
631
		header('Location: autoregistration.php');
633
		header('Location: autoregistration.php');
632
		exit();
634
		exit();
633
	}
635
	}
634
 
636
 
635
	if(isset($_GET["b_country_enable"])){
637
	if(isset($_GET["b_country_enable"])){
636
		exec("sudo $script --change_country_ena_all");		
638
		exec("sudo $script --change_country_ena_all");		
637
		exec("sudo $script --change_country_filter all");
639
		exec("sudo $script --change_country_filter all");
638
		header('Location: autoregistration.php');
640
		header('Location: autoregistration.php');
639
		exit();
641
		exit();
640
	}
642
	}
641
 
643
 
642
	if(isset($_GET["b_country_disable"])){
644
	if(isset($_GET["b_country_disable"])){
643
		exec("sudo $script --change_country_dis_all");
645
		exec("sudo $script --change_country_dis_all");
644
		header('Location: autoregistration.php');
646
		header('Location: autoregistration.php');
645
		exit();
647
		exit();
646
	}
648
	}
647
 
649
 
648
 
650
 
649
	#Si une clé 3g est plugué
651
	#Si une clé 3g est plugué
650
	echo "<form action=\"autoregistration.php\" methode=\"GET\">
652
	echo "<form action=\"autoregistration.php\" methode=\"GET\">
651
			
653
			
652
		<table border=1>
654
		<table border=1>
653
		<tr>
655
		<tr>
654
			<td colspan=4><b>$l_status_gammu</b></td>
656
			<td colspan=4><b>$l_status_gammu</b></td>
655
			<td><b><center>$l_force_signal</center></b></td>
657
			<td><b><center>$l_force_signal</center></b></td>
656
			<td><b><center>$l_imei_device</center></b></td> 
658
			<td><b><center>$l_imei_device</center></b></td> 
657
			<td><b><center>$l_sms_received</center></b></td> 
659
			<td><b><center>$l_sms_received</center></b></td> 
658
		</tr>
660
		</tr>
659
		<tr>
661
		<tr>
660
			$gammu
662
			$gammu
661
			<td><button type=\"submit\" name=\"start\" $gammu_status_on>$l_start</button></td>		
663
			<td><button type=\"submit\" name=\"start\" $gammu_status_on>$l_start</button></td>		
662
			<td><button type=\"submit\" name=\"stop\" $gammu_status_off>$l_stop</button></td>
664
			<td><button type=\"submit\" name=\"stop\" $gammu_status_off>$l_stop</button></td>
663
			<td><center>$force_signal</center></td>
665
			<td><center>$force_signal</center></td>
664
			<td><center>$imei_device</center></td>
666
			<td><center>$imei_device</center></td>
665
			<td><center>$sms_received</center></td>
667
			<td><center>$sms_received</center></td>
666
		</tr>
668
		</tr>
667
		$gammu_puk
669
		$gammu_puk
668
		$gammu_simfail
670
		$gammu_simfail
669
		$gammu_simsecu
671
		$gammu_simsecu
670
		$gammu_timeout
672
		$gammu_timeout
671
		$gammu_writeerror
673
		$gammu_writeerror
672
		</table>
674
		</table>
673
	<br /><br />
675
	<br /><br />
674
		
676
		
675
		<table border=1>
677
		<table border=1>
676
		<tr>
678
		<tr>
677
		<td colspan=3><b>$l_conf</b></td>
679
		<td colspan=3><b>$l_conf</b></td>
678
		<td><b>$l_conf_actu</b></td>
680
		<td><b>$l_conf_actu</b></td>
679
		</tr>
681
		</tr>
680
		
682
		
681
		<tr>
683
		<tr>
682
		<td> $l_num_alcasar </td><td><input type=text name='num_alcasar' maxlength=\"20\"></td>
684
		<td> $l_num_alcasar </td><td><input type=text name='num_alcasar' maxlength=\"20\"></td>
683
		<td><button type=\"submit\" name=\"b_num_alcasar\" $gammu_status_on>$l_edit</button></td>
685
		<td><button type=\"submit\" name=\"b_num_alcasar\" $gammu_status_on>$l_edit</button></td>
684
		<td><center><font color=\"green\">$current_num_alcasar</font></center></td>
686
		<td><center><font color=\"green\">$current_num_alcasar</font></center></td>
685
		</tr>
687
		</tr>
686
		<tr><td colspan=\"4\"><font color=red><b>$error_num_alcasar</b></font></td></tr>
688
		<tr><td colspan=\"4\"><font color=red><b>$error_num_alcasar</b></font></td></tr>
687
		
689
		
688
		<tr>		
690
		<tr>		
689
		<td> $l_pin </td><td><input type=text name='pin' maxlength=\"8\"></td>
691
		<td> $l_pin </td><td><input type=text name='pin' maxlength=\"8\"></td>
690
		<td><button type=\"submit\" name=\"b_pin\" $gammu_status_on>$l_edit</button></td>
692
		<td><button type=\"submit\" name=\"b_pin\" $gammu_status_on>$l_edit</button></td>
691
		<td><center><font color=\"green\">$current_pin</font></center></td>
693
		<td><center><font color=\"green\">$current_pin</font></center></td>
692
		</tr>
694
		</tr>
693
		<tr><td colspan=\"4\"><font color=red><b>$error_pin</b></font></td></tr>
695
		<tr><td colspan=\"4\"><font color=red><b>$error_pin</b></font></td></tr>
694
		
696
		
695
		<tr>
697
		<tr>
696
		<td> $l_time_account </td><td><input type=text name='time_account'> $l_days </td>
698
		<td> $l_time_account </td><td><input type=text name='time_account'> $l_days </td>
697
		<td><button type=\"submit\" name=\"b_time_account\" $gammu_status_on>$l_edit</button></td>	
699
		<td><button type=\"submit\" name=\"b_time_account\" $gammu_status_on>$l_edit</button></td>	
698
		<td><center><font color=\"blue\">$current_time_account</font></center></td>
700
		<td><center><font color=\"blue\">$current_time_account</font></center></td>
699
		</tr>
701
		</tr>
700
		<tr><td colspan=\"4\"><font color=red><b>$error_time_account</b></font></td></tr>
702
		<tr><td colspan=\"4\"><font color=red><b>$error_time_account</b></font></td></tr>
701
		
703
		
702
		<tr>
704
		<tr>
703
		<td> $l_ban_temp </td><td><input type=text name='nb_essais'></td>	
705
		<td> $l_ban_temp </td><td><input type=text name='nb_essais'></td>	
704
		<td><button type=\"submit\" name=\"b_ban_temp\" $gammu_status_on>$l_edit</button></td>	
706
		<td><button type=\"submit\" name=\"b_ban_temp\" $gammu_status_on>$l_edit</button></td>	
705
		<td><center><font color=\"orange\">$current_try_ban</font></center></td>
707
		<td><center><font color=\"orange\">$current_try_ban</font></center></td>
706
		</tr>
708
		</tr>
707
		<tr><td colspan=\"4\"><font color=red><b>$error_nb_essais</b></font></td></tr>
709
		<tr><td colspan=\"4\"><font color=red><b>$error_nb_essais</b></font></td></tr>
708
		
710
		
709
		<tr>
711
		<tr>
710
		<td>$l_time_perm</td><td><input type=text name='time_perm'> $l_days</td>
712
		<td>$l_time_perm</td><td><input type=text name='time_perm'> $l_days</td>
711
		<td><button type=\"submit\" name=\"b_time_perm\" $gammu_status_on>$l_edit</button></td>	
713
		<td><button type=\"submit\" name=\"b_time_perm\" $gammu_status_on>$l_edit</button></td>	
712
		<td><center><font color=\"orange\">$current_time_perm</font></center></td>
714
		<td><center><font color=\"orange\">$current_time_perm</font></center></td>
713
		</tr>
715
		</tr>
714
		<tr><td colspan=\"4\"><font color=red><b>$error_time_perm</b></font></td></tr>
716
		<tr><td colspan=\"4\"><font color=red><b>$error_time_perm</b></font></td></tr>
715
		</table>
717
		</table>
716
		</form>";
718
		</form>";
717
 
719
 
718
	
720
	
719
	require('/etc/freeradius-web/config.php');
721
	require('/etc/freeradius-web/config.php');
720
 
722
 
721
	if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
723
	if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
722
		include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
724
		include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
723
	else{
725
	else{
724
		echo "<b>Could not include SQL library</b>\n";
726
		echo "<b>Could not include SQL library</b>\n";
725
		exit();
727
		exit();
726
	}
728
	}
727
 
729
 
728
	$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
730
	$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
729
 
731
 
730
	if(mysqli_connect_errno())
732
	if(mysqli_connect_errno())
731
	{
733
	{
732
		echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
734
		echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
733
	}
735
	}
734
 
736
 
735
 
737
 
736
	# Country table
738
	# Country table
737
 
739
 
738
?>
740
?>
739
 
741
 
740
	<div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;">
742
	<div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;">
741
		 <span class="showhide-but_country"><?php echo "<strong>$l_country_filtering<strong>" ?><img src="/images/down2.gif" width="15" height="15"></span>
743
		 <span class="showhide-but_country"><?php echo "<strong>$l_country_filtering<strong>" ?><img src="/images/down2.gif" width="15" height="15"></span>
742
 
744
 
743
		<div class="showhide-div_country">
745
		<div class="showhide-div_country">
744
		<br />
746
		<br />
745
			<table width=100% style="background: #BDBDBD;">
747
			<table width=100% style="background: #BDBDBD;">
746
			<tr>
748
			<tr>
747
				<?php 
749
				<?php 
748
					$result_country_filter = mysqli_query($con, "SELECT id FROM SMS_country WHERE name = 'FILTRAGE'");
750
					$result_country_filter = mysqli_query($con, "SELECT id FROM SMS_country WHERE name = 'FILTRAGE'");
749
					$row = mysqli_fetch_array($result_country_filter);
751
					$row = mysqli_fetch_array($result_country_filter);
750
 
752
 
751
					if($row['id'] == "advance") {
753
					if($row['id'] == "advance") {
752
						$country_filter = $l_country_advanced_ena;
754
						$country_filter = $l_country_advanced_ena;
753
					} elseif($row['id'] == "ue") {
755
					} elseif($row['id'] == "ue") {
754
						$country_filter = $l_country_ue_ena;
756
						$country_filter = $l_country_ue_ena;
755
					} elseif($row['id'] == "fr") {
757
					} elseif($row['id'] == "fr") {
756
						$country_filter = $l_country_france_ena;
758
						$country_filter = $l_country_france_ena;
757
					} elseif($row['id'] == "all") {
759
					} elseif($row['id'] == "all") {
758
						$country_filter = $l_country_all_ena;
760
						$country_filter = $l_country_all_ena;
759
					} else {
761
					} else {
760
						$country_filter = "Err.";
762
						$country_filter = "Err.";
761
					}
763
					}
762
				?>
764
				?>
763
				<td colspan="3" align="center"><strong><?php echo $l_country_filter; ?></strong><font size="3" color="red"><?php echo $country_filter; ?></font></td>
765
				<td colspan="3" align="center"><strong><?php echo $l_country_filter; ?></strong><font size="3" color="red"><?php echo $country_filter; ?></font></td>
764
			</tr>
766
			</tr>
765
			<tr>
767
			<tr>
766
				<form action="autoregistration.php" methode="POST">
768
				<form action="autoregistration.php" methode="POST">
767
					<td align="center" width=33%><button type="submit" name="b_france_enable"><?php echo "$l_country_france_ena" ?></button></td>
769
					<td align="center" width=33%><button type="submit" name="b_france_enable"><?php echo "$l_country_france_ena" ?></button></td>
768
					<td align="center" width=34%><button type="submit" name="b_ue_enable"><?php echo "$l_country_ue_ena" ?></button></td>
770
					<td align="center" width=34%><button type="submit" name="b_ue_enable"><?php echo "$l_country_ue_ena" ?></button></td>
769
					<td align="center" width=33%><button type="submit" name="b_country_enable"><?php echo "$l_country_all_ena" ?></button></td>
771
					<td align="center" width=33%><button type="submit" name="b_country_enable"><?php echo "$l_country_all_ena" ?></button></td>
770
				</form>
772
				</form>
771
			</tr>	
773
			</tr>	
772
			</table>
774
			</table>
773
			<div style="border-radius: 5px; background: #D8D8D8; margin: 15px;">
775
			<div style="border-radius: 5px; background: #D8D8D8; margin: 15px;">
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>
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>
775
				<div class="showhide-div_country_plus">
777
				<div class="showhide-div_country_plus">
776
				<table id="table_country" class="display">
778
				<table id="table_country" class="display">
777
					<thead>
779
					<thead>
778
						<tr>
780
						<tr>
779
							<th><b><font color="black">Pays</font></b></th>
781
							<th><b><font color="black">Pays</font></b></th>
780
							<th><b><font color="black">code</font></b></th>
782
							<th><b><font color="black">code</font></b></th>
781
							<th><b><font color="black">Etat</font></b></th>
783
							<th><b><font color="black">Etat</font></b></th>
782
						</tr>
784
						</tr>
783
					</thead>
785
					</thead>
784
					<tbody>
786
					<tbody>
785
						<?php 
787
						<?php 
786
 
788
 
787
						$result_country = mysqli_query($con, "SELECT * FROM SMS_country WHERE name != 'FILTRAGE'");
789
						$result_country = mysqli_query($con, "SELECT * FROM SMS_country WHERE name != 'FILTRAGE'");
788
						while($row = mysqli_fetch_array($result_country))
790
						while($row = mysqli_fetch_array($result_country))
789
						{
791
						{
790
						echo "	
792
						echo "	
791
						<tr>
793
						<tr>
792
						<form action=\"autoregistration.php\" methode=\"POST\">
794
						<form action=\"autoregistration.php\" methode=\"POST\">
793
						<td>
795
						<td>
794
							<input type=\"hidden\" name=\"country_select\" value=\"" .$row['name']."\">	
796
							<input type=\"hidden\" name=\"country_select\" value=\"" .$row['name']."\">	
795
							".$row['name']."
797
							".$row['name']."
796
						</td>
798
						</td>
797
						<td>".$row['id']."</td>
799
						<td>".$row['id']."</td>
798
						";
800
						";
799
			
801
			
800
						if($row['status']=='0')
802
						if($row['status']=='0')
801
						{
803
						{
802
							echo "<td><input type='image' src=\"/images/state_error.gif\" width=\"15\" height=\"15\"></td>";
804
							echo "<td><input type='image' src=\"/images/state_error.gif\" width=\"15\" height=\"15\"></td>";
803
						}
805
						}
804
						if($row['status']=='1')
806
						if($row['status']=='1')
805
						{
807
						{
806
							echo "<td><input type='image' src=\"/images/state_ok.gif\" width=\"15\" height=\"15\"></td>";
808
							echo "<td><input type='image' src=\"/images/state_ok.gif\" width=\"15\" height=\"15\"></td>";
807
						}
809
						}
808
						echo "	</form>
810
						echo "	</form>
809
							</tr>
811
							</tr>
810
							";
812
							";
811
						}
813
						}
812
						?>
814
						?>
813
					</tbody>
815
					</tbody>
814
				</table>
816
				</table>
815
				</div>
817
				</div>
816
			</div>
818
			</div>
817
		</div>	
819
		</div>	
818
	</div>
820
	</div>
819
<?php 
821
<?php 
820
	$result = mysqli_query($con, "SELECT * FROM SMS_ban_perm");
822
	$result = mysqli_query($con, "SELECT * FROM SMS_ban_perm");
821
 
823
 
822
?>
824
?>
823
 
825
 
824
<div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;">
826
<div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;">
825
		<span class="showhide-but_ban"><?php echo "<strong>$l_phone_ban</strong>" ?><img src="/images/down2.gif" width="15" height="15"></span>
827
		<span class="showhide-but_ban"><?php echo "<strong>$l_phone_ban</strong>" ?><img src="/images/down2.gif" width="15" height="15"></span>
826
 
828
 
827
		<div class="showhide-div_ban">
829
		<div class="showhide-div_ban">
828
	
830
	
829
			<table id="table_id" class="display">
831
			<table id="table_id" class="display">
830
				<thead>
832
				<thead>
831
					<tr>
833
					<tr>
832
						<th><b><font color="black"><?php echo $l_num_num; ?></font></b></th>
834
						<th><b><font color="black"><?php echo $l_num_num; ?></font></b></th>
833
						<th><b><font color="black"><?php echo $l_num_raison; ?></font></b></th>
835
						<th><b><font color="black"><?php echo $l_num_raison; ?></font></b></th>
834
						<th><b><font color="black"><?php echo $l_num_expiration; ?></font></b></th>
836
						<th><b><font color="black"><?php echo $l_num_expiration; ?></font></b></th>
835
						<th><b><font color="black">Action</font></b></th>
837
						<th><b><font color="black">Action</font></b></th>
836
					</tr>
838
					</tr>
837
				</thead>
839
				</thead>
838
				<tbody>
840
				<tbody>
839
					<?php 
841
					<?php 
840
					while($row = mysqli_fetch_array($result))
842
					while($row = mysqli_fetch_array($result))
841
					{
843
					{
842
					echo "	
844
					echo "	
843
						<tr>
845
						<tr>
844
						<form action=\"autoregistration.php\" methode=\"POST\">
846
						<form action=\"autoregistration.php\" methode=\"POST\">
845
						<td>
847
						<td>
846
							<input type=\"hidden\" name=\"num_select\" value=\"" .$row['SenderNumber']."\">	
848
							<input type=\"hidden\" name=\"num_select\" value=\"" .$row['SenderNumber']."\">	
847
							".$row['SenderNumber']."
849
							".$row['SenderNumber']."
848
						</td>";
850
						</td>";
849
		
851
		
850
					if($row['Perm']=='0')
852
					if($row['Perm']=='0')
851
					{
853
					{
852
						echo "<td>$l_num_exist</td>";
854
						echo "<td>$l_num_exist</td>";
853
					}
855
					}
854
					if($row['Perm']=='1')
856
					if($row['Perm']=='1')
855
					{
857
					{
856
						echo "<td>$l_num_flood</td>";
858
						echo "<td>$l_num_flood</td>";
857
					}
859
					}
858
					echo "	<td>" . $row['Expiration']. "</td>
860
					echo "	<td>" . $row['Expiration']. "</td>
859
							<td>
861
							<td>
860
								<input type='submit' value='".$l_num_unlock."'>
862
								<input type='submit' value='".$l_num_unlock."'>
861
							</td>
863
							</td>
862
							</form>
864
							</form>
863
						</tr>
865
						</tr>
864
						";
866
						";
865
					}
867
					}
866
					?>
868
					?>
867
				</tbody>
869
				</tbody>
868
			</table>
870
			</table>
869
		</div>
871
		</div>
870
	</div>
872
	</div>
871
<?php
873
<?php
872
	mysqli_close($con);
874
	mysqli_close($con);
873
	}
875
	}
874
?>
876
?>
875
</html>
877
</html>
876
 
878