Subversion Repositories ALCASAR

Rev

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

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