Rev 2317 | Go to most recent revision | Blame | Last modification | View Log
<?php
# $Id: autoregistration.php 2349 2017-07-22 12:20:21Z tom.houdayer $
# Test if 3G/4G key is plugged
$exec_com=exec("lsusb | grep -i 067b: | cut -d ' ' -f6"); // converter "USB to UART" PL2303 (several USB-serial cables, Wavecom GSM Modem)
$exec_com2=exec("lsusb | grep -i 12d1: | cut -d ' ' -f6"); // Huawei Technologies (E220/E230/E270/E870
//$exec_com2=exec("lsusb | grep -i 2001: | cut -d ' ' -f6"); // Dlink (to test)
$status_key="false";
$script="/usr/local/bin/alcasar-sms.sh";
#Define
$gammu_puk = "";
$gammu_simfail = "";
$gammu_simsecu = "";
$gammu_writeerror = "";
$gammu_timeout = "";
$error_pin = "";
$error_time_account = "";
$error_nb_essais = "";
$error_time_perm = "";
$error_num_alcasar = "";
$country_filter="";
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
if($Language == 'fr'){
$l_title = "Auto enregistrement (SMS)";
$l_conf = "Configuration";
$l_conf_actu = "Configuration actuelle";
$l_pin = "Code PIN";
$l_num_alcasar = "Numero de téléphone du MODEM GSM";
$l_ban_temp = "Nombre d'essais avant le blocage";
$l_time_account = "Durée pour une session créée";
$l_time_perm = "Durée du blocage (en jours)";
$l_status_gammu = "Etat du service";
$l_start = "Démarrer";
$l_status_device = "Status de votre MODEM GSM (clé 2G/3G/4G)";
$l_key_diseable = "Aucun périphérique détecté";
$l_key_enable = "Votre MODEM GSM est connectée à la vitesse de : ";
$l_force_signal = "Force du signal";
$l_imei_device = "IMEI du périphérique";
$l_sms_received = "Nombre de SMS reçu";
$l_stop = "Arrêter";
$l_gammu_on="Le service est démarré";
$l_gammu_off="Le service est arrêté";
$l_edit = "Modifier";
$l_error_label_empty = "Le champ est vide";
$l_error_label_num = "Ce n'est pas un PIN valide";
$l_error_label_num2 = "Ce n'est pas un nombre";
$l_error_label_num3 = "Le format n'est pas correct: +xxxYYYYYYYYY (xxx: code pays / YYYYYYYYY: numéro de téléphone)";
$l_error_writefail = "Le service ne parvient pas à discuter avec le port du MODEM GSM (ttyUSB0).";
$l_error_timeoutfail = "Impossible de se connecter au MODEM GSM (vérifiez la vitesse de connexion)";
$l_error_simfail = "Un problème au niveau de la carte SIM a été détecté. Est elle présente?";
$l_error_simsecu_l = "Attention, lors du dernier démarrage, votre code PIN était erroné.<br>
La SIM doit être bloqué (code PUK). Consultez la documentation.";
$l_autorefresh = "Rafraichissement : 30 sec";
$l_days = "jours ";
$l_num_block="Liste des numéros bloqués";
$l_num_num="Numéro";
$l_num_raison="Raison";
$l_num_expiration="Date d'expiration";
$l_num_action="Action";
$l_num_exist="Un compte a été créé";
$l_num_flood="Le nombre d'essais maximum a été dépassé";
$l_num_unlock="Effacer";
$l_country_enable="Activer";
$l_country_disable="Désactiver";
$l_service_status_img_ok="Démarré";
$l_service_status_img_ko="Arrété";
$l_conf_name="Modifier la vitesse de connexion : ";
$l_tab_first = "premier";
$l_tab_last = "dernier";
$l_tab_next = "suivant";
$l_tab_prev = "précédent";
$l_tab_search = "Recherche :";
$l_tab_pmenu = "Affiche la page _PAGE_ sur _PAGES_";
$l_tab_info = "Montrer _MENU_ résultats par page";
$l_tab_infoempty = "Aucun résultat";
$l_country_filter = "Filtrage en cours : ";
$l_country_filtering = " Filtrage par pays";
$l_country_filtering_plus = " Filtrage par pays avancé";
$l_phone_ban = " Numéro de téléphone bloqués";
$l_country_france_ena = "Autorise les numéros français";
$l_country_ue_ena = "Autorise les numéros européens";
$l_country_all_ena = "Autorise tous les pays";
$l_country_advanced_ena = "Autorisation personnalisé";
$l_advance = "Avancé";
}
else {
$l_title = "Auto registration (SMS)";
$l_conf = "Configuration";
$l_conf_actu = "Current configuration";
$l_pin = "PIN password";
$l_num_alcasar = "Phone number of the GSM MODEM";
$l_ban_temp = "Max number of try before a permanent ban";
$l_time_account = "Time for a new session";
$l_time_perm = "Duration of a ban (for example, after X try)";
$l_status_gammu = "Service status";
$l_start = "Start";
$l_status_device = "Status of your GSM MODEM (2G/3G/4G key)";
$l_key_diseable = "No device detected";
$l_key_enable = "Your GSM MODEM is connected at the speed of : ";
$l_force_signal = "Signal strength";
$l_imei_device = "Device IMEI";
$l_sms_received = "Number of SMS received";
$l_stop = "Stop";
$l_gammu_on="The service is running";
$l_gammu_off="The service is down";
$l_edit = "Modify";
$l_error_label_empty = "Field empty";
$l_error_label_num = "It's not a valid PIN password";
$l_error_label_num2 = "It's not a number";
$l_error_label_num3 = "The phone number is not good: +xxxYYYYYYYYY (xxx: code pays / YYYYYYYYY: numéro de téléphone)";
$l_error_writefail = "Can not communicate with the GSM MODEM port (ttyUSB0).";
$l_error_timeoutfail = "Can not connect to the GSM MODEM (verify the connection speed).";
$l_error_simfail = "An issue with your Sim card was detected. Is it in the key?";
$l_error_simsecu_l = "Warning, during the last startup, the PIN code was wrong. <br>
The Sim card must be blocked. Please read the documentation.";
$l_autorefresh = "Refresh : 30 sec";
$l_days = "days ";
$l_num_block="List of blocked phone";
$l_num_num="Phone number";
$l_num_raison="Reason";
$l_num_expiration="Expiration date";
$l_num_action="Action";
$l_num_exist="An account has been created";
$l_num_flood="The number of try has been reached";
$l_num_unlock="Erase";
$l_country_enable="Enable";
$l_country_disable="Disable";
$l_service_status_img_ok="Running";
$l_service_status_img_ko="Stopped";
$l_conf_name="Modify the speed : ";
$l_tab_first = "first";
$l_tab_last = "last";
$l_tab_next = "next";
$l_tab_prev = "previous";
$l_tab_search = "Search :";
$l_tab_pmenu = "Showing _PAGE_ to _PAGE_ of _PAGE_ entries :";
$l_tab_info = "Show _MENU_ entries";
$l_tab_infoempty = "No matching records found";
$l_country_filter = "Current filtering : ";
$l_country_filtering = " Country filtering";
$l_country_filtering_plus = " Country filtering advanced";
$l_phone_ban = " Phone Number banned";
$l_country_france_ena = "Authorize the french numbers";
$l_country_ue_ena = "Authorize european numbers";
$l_country_all_ena = "Authorize all countries";
$l_country_advanced_ena = "Advanced Authorization";
$l_advance = "Advanced";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><!-- written by Rexy -->
<head>
<!--<META HTTP-EQUIV="Refresh" CONTENT="30">-->
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
<title>Auto enregistrement</title>
<link rel="stylesheet" href="/css/style.css">
<!-- DataTables CSS -->
<link rel="stylesheet" type="text/css" href="/css/jquery.dataTables.css">
<!-- jQuery -->
<script type="text/javascript" charset="utf8" src="/js/jquery.min.js"></script>
<!-- DataTables -->
<script type="text/javascript" charset="utf8" src="/js/jquery.dataTables.js"></script>
<script type="text/javascript">
function timedRefresh(timeoutPeriod) {
var interval = setInterval(refreshPage, timeoutPeriod);
}
function refreshPage() {
if ($("input[name=autoRefreshCheckboxes]").is(":checked")) {
location.reload(true);
}
}
$(document).ready( function () {
$('#table_id').DataTable({
"language": {
"paginate": {
"sFirst": "<?php echo $l_tab_first; ?>",
"sLast": "<?php echo $l_tab_last; ?>",
"sPrevious": "<?php echo $l_tab_prev; ?>",
"sNext": "<?php echo $l_tab_next; ?>"
},
"lengthMenu": "<?php echo $l_tab_info; ?>",
"zeroRecords": "<?php echo $l_tab_infoempty; ?>",
"info": "<?php echo $l_tab_pmenu; ?>",
"infoEmpty": "<?php echo $l_tab_infoempty; ?>",
"sSearch": "<?php echo $l_tab_search; ?>"
}
});
$('#table_country').DataTable({
"language": {
"paginate": {
"sFirst": "<?php echo $l_tab_first; ?>",
"sLast": "<?php echo $l_tab_last; ?>",
"sPrevious": "<?php echo $l_tab_prev; ?>",
"sNext": "<?php echo $l_tab_next; ?>"
},
"lengthMenu": "<?php echo $l_tab_info; ?>",
"zeroRecords": "<?php echo $l_tab_infoempty; ?>",
"info": "<?php echo $l_tab_pmenu; ?>",
"infoEmpty": "<?php echo $l_tab_infoempty; ?>",
"sSearch": "<?php echo $l_tab_search; ?>"
}
});
$(".showhide-div_country").slideUp("slow");
$(".showhide-div_ban").slideUp("slow");
$(".showhide-div_country_plus").slideUp("slow");
$(".showhide-but_country").on("click", function(){
$(".showhide-div_country").slideToggle("slow");
});
$(".showhide-but_country_plus").on("click", function(){
$(".showhide-div_country_plus").slideToggle("slow");
});
$(".showhide-but_ban").on("click", function(){
$(".showhide-div_ban").slideToggle("slow");
});
} );
</script>
</head>
<body onload="JavaScript:timedRefresh(30000);">
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<?php
echo "
<tr>
<th>$l_title</th>
</tr>
<tr bgcolor=\"#FFCC66\">
<td><img src=\"/images/pix.gif\" width=\"1\" height=\"2\"></td>
</tr>
</TABLE>
<br />
<input type='checkbox' checked='checked' name='autoRefreshCheckboxes' >".$l_autorefresh."
";
?>
<center>
<br /><br />
<form form="GET" action="./autoregistration.php">
<table border=1 width=100%>
<tr>
<td colspan=2><h3><?php echo $l_status_device ?></h3></td>
</tr>
<tr>
<?php
if(!empty($exec_com) || !empty($exec_com2))
{
if(isset($_GET['config_submit'])){
switch ($_GET['config']) {
case "at":
exec("sudo $script --replace_connect ");
break;
case "9600":
exec("sudo $script --replace_connect 9600");
break;
case "19200":
exec("sudo $script --replace_connect 19200");
break;
case "115200":
exec("sudo $script --replace_connect 115200");
break;
}
}
$current_connect = exec("sudo $script --connect");
echo '<td width="50%">'.$l_key_enable.$current_connect.' Bauds</td>';
echo ' <td align="right"> '.$l_conf_name.'
<select name="config">
<option value="at"></option>
<option value="9600">9600 Bauds</option>
<option value="19200">19200 Bauds</option>
<option value="115200">115200 Bauds</option>
</select>
<input type="submit" name="config_submit">
</td>
';
$status_key="true";
}
else
{
echo "<td>$l_key_diseable</td>";
$status_key="false";
}
?>
</tr>
</table>
</form>
</center>
<br /><br />
<?php
#Test if gammu is started
$gammu_pid=exec("sudo $script --pidof");
if ($status_key=="false")
{
if ($gammu_pid!="")
{
exec("sudo $script stop");
sleep(8);
header('Location: autoregistration.php');
exit();
}
}
if ($status_key=="true")
{
#Nom du fichier de log lorsque gammu est démarré
#$file_log = "gammu-smsd.log";
#Recuperation du code PIN actuel
$current_pin = exec("sudo $script --pin");
#Recuperation du nombre de try avant le ban perm
$current_try_ban = exec("sudo $script --try_ban");
#Recuperation de la durée d'une session créée
$current_time_account = exec("sudo $script --time_account");
#Recuperation de la durée dun ban perm (après flood)
$current_time_perm = exec("sudo $script --time_perm");
#Detection neméro de tel
$current_num_alcasar = exec("sudo $script --numero_alcasar");
#Detection problème avec la SIM
$current_simfail = exec("sudo $script --last_nosim");
#Recuperation de la dernière ligne de START
$current_last_start = exec("sudo $script --last_start");
#Recuperarion de la dernière ligne de STOP
$current_last_stop = exec("sudo $script --last_stop");
#Recuperation de la dernière ligne de SECURITYERROR
$current_last_secu = exec("sudo $script --last_secu");
#Recuperation de la dernière ligne de DEVICEWRITEERROR
$current_last_write = exec("sudo $script --last_writeerror");
#Recuperation de la dernière ligne de TIMEOUT
$current_last_timeout = exec("sudo $script --last_timeout");
# Test si le service est lancé
if ($gammu_pid=="")
{
$force_signal = "-";
$imei_device = "-";
$sms_received = "-";
$gammu="<td><img src=\"/images/state_error.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ko."\"></td><td>$l_gammu_off</td>";
$gammu_status_on="";
$gammu_status_off="disabled";
if($current_last_secu!="")
{
if(($current_last_secu > $current_last_start) && ($current_last_secu < $current_last_stop))
{
$gammu_simsecu="<tr><td colspan=7><font color=red>$l_error_simsecu_l</font></td></tr>";
}
}
} else {
# Recuperation de la force du signal et IMEI et nombre de sms reçu
$val_force_signal = exec("sudo $script --signal_device");
$imei_device = exec("sudo $script --imei_device");
$sms_received = exec("sudo $script --sms_received");
if ($val_force_signal < 21) {
$force_signal = "<img src=\"/images/signal_0.png\"> -- ".$val_force_signal." %";
} elseif ($val_force_signal < 41) {
$force_signal = "<img src=\"/images/signal_20.png\"> -- ".$val_force_signal." %";
} elseif ($val_force_signal < 61) {
$force_signal = "<img src=\"/images/signal_40.png\"> -- ".$val_force_signal." %";
} elseif ($val_force_signal < 81) {
$force_signal = "<img src=\"/images/signal_60.png\"> -- ".$val_force_signal." %";
} elseif ($val_force_signal < 101) {
$force_signal = "<img src=\"/images/signal_80.png\"> -- ".$val_force_signal." %";
}
$gammu="<td><img src=\"/images/state_ok.gif\" width=\"15\" height=\"15\" alt=\"".$l_service_status_img_ok."\"></td><td>$l_gammu_on</td>";
if($current_last_timeout!=""){
if(($current_last_timeout > $current_last_start) && ($current_last_timeout > $current_last_stop))
{
$gammu_timeout="<tr><td colspan=7><font color=red>$l_error_timeoutfail</font></td></tr>";
}
}
if($current_last_secu!="")
{
if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
{
exec("sudo $script --stop");
}
}
if($current_last_write!=""){
if(($current_last_write > $current_last_start) && ($current_last_write > $current_last_stop))
{
$gammu_writeerror="<tr><td colspan=7><font color=red>$l_error_writefail</font></td></tr>";
}
}
if($current_simfail!="")
{
if(($current_simfail > $current_last_start) && ($current_simfail > $current_last_stop))
{
$gammu_simfail="<tr><td colspan=7><font color=red>$l_error_simfail</font></td></tr>";
}
}
$gammu_status_on="disabled";
$gammu_status_off="";
}
#Lancement et arret de gammu-smsd 3*7sec
if(isset($_GET["start"])){
$gammu_1=exec("sudo $script --start");
sleep(7);
if($current_last_secu!="")
{
if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
{
exec("sudo $script --stop");
}
}
sleep(7);
if($current_last_secu!="")
{
if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
{
exec("sudo $script --stop");
}
}
sleep(7);
if($current_last_secu!="")
{
if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
{
exec("sudo $script --stop");
}
}
header('Location: autoregistration.php');
exit();
}
if(isset($_GET["stop"])){
exec("sudo $script --stop");
sleep(8);
header('Location: autoregistration.php');
exit();
}
#Edition du NUMERO de telephone
if(isset($_GET["b_num_alcasar"])){
$num = $_GET["num_alcasar"];
$error_num_alcasar = "";
if($num !="")
{
if(preg_match('#^\+#',$num))
{
exec("sudo $script --replace_numero_alcasar ".escapeshellarg($num));
header('Location: autoregistration.php');
exit();
}
else
{
$error_num_alcasar=$l_error_label_num3;
}
}
else
{
$error_num_alcasar=$l_error_label_empty;
}
}
#Edition du code PIN
if(isset($_GET["b_pin"])){
$pin = $_GET["pin"];
$error_pin = "";
if($pin !="")
{
if(is_numeric($pin))
{
exec("sudo $script --replace_pin ".escapeshellarg($pin));
header('Location: autoregistration.php');
exit();
}
else
{
$error_pin=$l_error_label_num;
}
}
else
{
$error_pin=$l_error_label_empty;
}
}
#Edition du nombre d'essais avant le ban perm
if(isset($_GET["b_ban_temp"])){
$nb_ban_temp = $_GET["nb_essais"];
$error_nb_essais = "";
if($nb_ban_temp !="")
{
if(is_numeric($nb_ban_temp))
{
exec("sudo $script --replace_try_ban ".escapeshellarg($nb_ban_temp));
header('Location: autoregistration.php');
exit();
}
else
{
$error_nb_essais=$l_error_label_num2;
}
}
else
{
$error_nb_essais=$l_error_label_empty;
}
}
#Edition de la durée pour un compte créé
if(isset($_GET["b_time_account"])){
$time_account = $_GET["time_account"];
$error_time_account = "";
if($time_account !="")
{
if(is_numeric($time_account))
{
exec("sudo $script --replace_time_account ".escapeshellarg($time_account));
header('Location: autoregistration.php');
exit();
}
else
{
$error_time_account=$l_error_label_num2;
}
}
else
{
$error_time_account=$l_error_label_empty;
}
}
#Edition de la durée d'un ban perm (après flood)
if(isset($_GET["b_time_perm"])){
$time_perm = $_GET["time_perm"];
$error_time_perm = "";
if($time_perm !="")
{
if(is_numeric($time_perm))
{
exec("sudo $script --replace_time_perm ".escapeshellarg($time_perm));
header('Location: autoregistration.php');
exit();
}
else
{
$error_time_perm=$l_error_label_num2;
}
}
else
{
$error_time_perm=$l_error_label_empty;
}
}
# Suppression d'un numero bloqué
if(isset($_GET['num_select'])){
$numero=$_GET['num_select'];
$add_mac=exec("sudo /usr/sbin/chilli_query list | grep ".escapeshellarg($numero)." | cut -d ' ' -f1");
if (!empty($add_mac)) {
exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($add_mac));
}
exec("sudo $script --unlock_num $numero");
header('Location: autoregistration.php');
exit();
}
# Edition etat pays
if(isset($_GET['country_select'])){
$country=utf8_decode($_GET['country_select']);
exec("sudo $script --change_country ".escapeshellarg($country));
exec("sudo $script --change_country_filter advance");
header('Location: autoregistration.php');
exit();
}
if(isset($_GET['b_france_enable'])){
exec("sudo $script --change_country_dis_all");
exec("sudo $script --change_country France");
exec("sudo $script --change_country_filter fr");
header('Location: autoregistration.php');
exit();
}
if(isset($_GET['b_ue_enable'])){
exec("sudo $script --change_country_dis_all");
$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");
foreach ($array_ue as $pays){
exec("sudo $script --change_country ".escapeshellarg($pays));
}
exec("sudo $script --change_country_filter ue");
header('Location: autoregistration.php');
exit();
}
if(isset($_GET["b_country_enable"])){
exec("sudo $script --change_country_ena_all");
exec("sudo $script --change_country_filter all");
header('Location: autoregistration.php');
exit();
}
if(isset($_GET["b_country_disable"])){
exec("sudo $script --change_country_dis_all");
header('Location: autoregistration.php');
exit();
}
#Si une clé 3g est plugué
echo "<form action=\"autoregistration.php\" methode=\"GET\">
<table border=1>
<tr>
<td colspan=4><b>$l_status_gammu</b></td>
<td><b><center>$l_force_signal</center></b></td>
<td><b><center>$l_imei_device</center></b></td>
<td><b><center>$l_sms_received</center></b></td>
</tr>
<tr>
$gammu
<td><button type=\"submit\" name=\"start\" $gammu_status_on>$l_start</button></td>
<td><button type=\"submit\" name=\"stop\" $gammu_status_off>$l_stop</button></td>
<td><center>$force_signal</center></td>
<td><center>$imei_device</center></td>
<td><center>$sms_received</center></td>
</tr>
$gammu_puk
$gammu_simfail
$gammu_simsecu
$gammu_timeout
$gammu_writeerror
</table>
<br /><br />
<table border=1>
<tr>
<td colspan=3><b>$l_conf</b></td>
<td><b>$l_conf_actu</b></td>
</tr>
<tr>
<td> $l_num_alcasar </td><td><input type=text name='num_alcasar' maxlength=\"20\"></td>
<td><button type=\"submit\" name=\"b_num_alcasar\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"green\">$current_num_alcasar</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_num_alcasar</b></font></td></tr>
<tr>
<td> $l_pin </td><td><input type=text name='pin' maxlength=\"8\"></td>
<td><button type=\"submit\" name=\"b_pin\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"green\">$current_pin</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_pin</b></font></td></tr>
<tr>
<td> $l_time_account </td><td><input type=text name='time_account'> $l_days </td>
<td><button type=\"submit\" name=\"b_time_account\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"blue\">$current_time_account</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_time_account</b></font></td></tr>
<tr>
<td> $l_ban_temp </td><td><input type=text name='nb_essais'></td>
<td><button type=\"submit\" name=\"b_ban_temp\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"orange\">$current_try_ban</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_nb_essais</b></font></td></tr>
<tr>
<td>$l_time_perm</td><td><input type=text name='time_perm'> $l_days</td>
<td><button type=\"submit\" name=\"b_time_perm\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"orange\">$current_time_perm</font></center></td>
</tr>
<tr><td colspan=\"4\"><font color=red><b>$error_time_perm</b></font></td></tr>
</table>
</form>";
require('/etc/freeradius-web/config.php');
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
else{
echo "<b>Could not include SQL library</b>\n";
exit();
}
$con = mysqli_connect("$config[sql_server]","$config[sql_username]","$config[sql_password]","gammu");
if(mysqli_connect_errno())
{
echo "Fail to connect to $config[sql_type]" . mysqli_connect_error();
}
# Country table
?>
<div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;">
<span class="showhide-but_country"><?php echo "<strong>$l_country_filtering<strong>" ?><img src="/images/down2.gif" width="15" height="15"></span>
<div class="showhide-div_country">
<br />
<table width=100% style="background: #BDBDBD;">
<tr>
<?php
$result_country_filter = mysqli_query($con, "SELECT id FROM SMS_country WHERE name = 'FILTRAGE'");
$row = mysqli_fetch_array($result_country_filter);
if($row['id'] == "advance") {
$country_filter = $l_country_advanced_ena;
} elseif($row['id'] == "ue") {
$country_filter = $l_country_ue_ena;
} elseif($row['id'] == "fr") {
$country_filter = $l_country_france_ena;
} elseif($row['id'] == "all") {
$country_filter = $l_country_all_ena;
} else {
$country_filter = "Err.";
}
?>
<td colspan="3" align="center"><strong><?php echo $l_country_filter; ?></strong><font size="3" color="red"><?php echo $country_filter; ?></font></td>
</tr>
<tr>
<form action="autoregistration.php" methode="POST">
<td align="center" width=33%><button type="submit" name="b_france_enable"><?php echo "$l_country_france_ena" ?></button></td>
<td align="center" width=34%><button type="submit" name="b_ue_enable"><?php echo "$l_country_ue_ena" ?></button></td>
<td align="center" width=33%><button type="submit" name="b_country_enable"><?php echo "$l_country_all_ena" ?></button></td>
</form>
</tr>
</table>
<div style="border-radius: 5px; background: #D8D8D8; margin: 15px;">
<span class="showhide-but_country_plus"><?php echo "<strong>$l_country_filtering_plus<strong>" ?> <img src="/images/down2.gif" width="15" height="15"></span>
<div class="showhide-div_country_plus">
<table id="table_country" class="display">
<thead>
<tr>
<th><b><font color="black">Pays</font></b></th>
<th><b><font color="black">code</font></b></th>
<th><b><font color="black">Etat</font></b></th>
</tr>
</thead>
<tbody>
<?php
$result_country = mysqli_query($con, "SELECT * FROM SMS_country WHERE name != 'FILTRAGE'");
while($row = mysqli_fetch_array($result_country))
{
echo "
<tr>
<form action=\"autoregistration.php\" methode=\"POST\">
<td>
<input type=\"hidden\" name=\"country_select\" value=\"" .$row['name']."\">
".$row['name']."
</td>
<td>".$row['id']."</td>
";
if($row['status']=='0')
{
echo "<td><input type='image' src=\"/images/state_error.gif\" width=\"15\" height=\"15\"></td>";
}
if($row['status']=='1')
{
echo "<td><input type='image' src=\"/images/state_ok.gif\" width=\"15\" height=\"15\"></td>";
}
echo " </form>
</tr>
";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php
$result = mysqli_query($con, "SELECT * FROM SMS_ban_perm");
?>
<div style="border-radius: 5px; background: #BDBDBD; margin-top: 15px;">
<span class="showhide-but_ban"><?php echo "<strong>$l_phone_ban</strong>" ?><img src="/images/down2.gif" width="15" height="15"></span>
<div class="showhide-div_ban">
<table id="table_id" class="display">
<thead>
<tr>
<th><b><font color="black"><?php echo $l_num_num; ?></font></b></th>
<th><b><font color="black"><?php echo $l_num_raison; ?></font></b></th>
<th><b><font color="black"><?php echo $l_num_expiration; ?></font></b></th>
<th><b><font color="black">Action</font></b></th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_array($result))
{
echo "
<tr>
<form action=\"autoregistration.php\" methode=\"POST\">
<td>
<input type=\"hidden\" name=\"num_select\" value=\"" .$row['SenderNumber']."\">
".$row['SenderNumber']."
</td>";
if($row['Perm']=='0')
{
echo "<td>$l_num_exist</td>";
}
if($row['Perm']=='1')
{
echo "<td>$l_num_flood</td>";
}
echo " <td>" . $row['Expiration']. "</td>
<td>
<input type='submit' value='".$l_num_unlock."'>
</td>
</form>
</tr>
";
}
?>
</tbody>
</table>
</div>
</div>
<?php
mysqli_close($con);
}
?>
</html>