Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2556 → Rev 2557

/web/acc/manager/htdocs/autoregistration.php
25,7 → 25,7
$find_key="true";
$vendor=exec("udevadm info -n $openned_ports[1] | grep 'MODEL=' | cut -d'=' -f2");
$model=exec("udevadm info -n $openned_ports[1] | grep 'MODEL_FROM_DATABASE=' | cut -d'=' -f2");
$gammu_smsd_port=exec("sudo $script --port"); // Gammu_smsd listen port
$gammu_smsd_port=exec("cat /etc/gammu_smsd_conf| grep port | cut -d ' ' -f3"); // Gammu_smsd listen port
while ( list(,$row) = each($openned_ports))
{
if ( "$row" == "$gammu_smsd_port" ) // is gammu listen on an openned port ?
282,7 → 282,6
</tr>
<tr>
<?php
echo "port = ".$b_port;
if($find_key=="true")
{
# Start / stop of gammu-smsd (3*7sec) --> to be improve with systemd unit (see tarball in contrib/init folder)
321,12 → 320,12
header('Location: autoregistration.php');
exit();
}
# Set the speed connexion to MODEM
if(isset($_POST["b_speed"])){
$speed = $_POST["speed"];
switch ($speed) {
# Set the connexion speed to MODEM
if(isset($_POST['b_speed'])){
switch ($_POST['speed']) {
case "at":
exec("sudo $script --replace_speed ");
exec("sudo $script --replace_speed");
break;
case "9600":
exec("sudo $script --replace_speed 9600");
337,21 → 336,23
case "115200":
exec("sudo $script --replace_speed 115200");
break;
header('Location: autoregistration.php');
exit();
}
//header('Location: autoregistration.php');
//exit();
}
# Set the com port
if(isset($_POST["b_port"])){
$port = $_POST["port"];
exec("sudo $script --replace_port ".escapeshellarg($port));
# Set the connexion port to MODEM
if(isset($_POST['b_port'])){
echo "speed = ".$_POST['port'];
$port = $_POST['port'];
exec("sudo $script --replace_port $port");
header('Location: autoregistration.php');
exit();
}
 
# Set the SIM phone number
if(isset($_POST["b_num_alcasar"])){
echo "speed = ".$_POST['num_alcasar'];
$num = $_POST["num_alcasar"];
$error_num_alcasar = "";
if($num !="")
396,49 → 397,49
}
}
 
# Set the number of tries before ban
if(isset($_POST["b_ban_temp"])){
$nb_ban_temp = $_POST["nb_essais"];
$error_nb_essais = "";
if($nb_ban_temp !="")
# Set the session timeout for each new account
if(isset($_POST["b_time_account"])){
$time_account = $_POST["time_account"];
$error_time_account = "";
if($time_account !="")
{
if(is_numeric($nb_ban_temp))
if(is_numeric($time_account))
{
exec("sudo $script --replace_try_ban ".escapeshellarg($nb_ban_temp));
exec("sudo $script --replace_time_account ".escapeshellarg($time_account));
header('Location: autoregistration.php');
exit();
}
else
{
$error_nb_essais=$l_error_label_num2;
$error_time_account=$l_error_label_num2;
}
}
else
{
$error_nb_essais=$l_error_label_empty;
$error_time_account=$l_error_label_empty;
}
}
 
# Set the session timeout for each new account
if(isset($_POST["b_time_account"])){
$time_account = $_POST["time_account"];
$error_time_account = "";
if($time_account !="")
# Set the number of tries before ban
if(isset($_POST["b_ban_temp"])){
$nb_ban_temp = $_POST["nb_essais"];
$error_nb_essais = "";
if($nb_ban_temp !="")
{
if(is_numeric($time_account))
if(is_numeric($nb_ban_temp))
{
exec("sudo $script --replace_time_account ".escapeshellarg($time_account));
exec("sudo $script --replace_try_ban ".escapeshellarg($nb_ban_temp));
header('Location: autoregistration.php');
exit();
}
else
{
$error_time_account=$l_error_label_num2;
$error_nb_essais=$l_error_label_num2;
}
}
else
{
$error_time_account=$l_error_label_empty;
$error_nb_essais=$l_error_label_empty;
}
}
 
542,11 → 543,7
#$file_log = "gammu-smsd.log";
 
#Recuperation de la vitesse de connexion
$current_speed = exec("sudo $script --speed");
$current_speed=str_replace("at","",$current_speed)." bauds";
if ($current_speed == " bauds") {
$current_speed = "Auto";
}
$current_speed = exec("sudo $script --connect");
 
#Recuperation du code PIN actuel
$current_pin = exec("sudo $script --pin");
557,7 → 554,7
#Recuperation de la durée d'une session créée
$current_time_account = exec("sudo $script --time_account");
 
#Recuperation de la durée du ban perm (après flood)
#Recuperation de la durée dun ban perm (après flood)
$current_time_perm = exec("sudo $script --time_perm");
 
#Detection neméro de tel
581,7 → 578,8
#Recuperation de la dernière ligne de TIMEOUT
$current_last_timeout = exec("sudo $script --last_timeout");
if ($gammu_pid=="") # gammu_smsd is not started
# Test si le service est lancé
if ($gammu_pid=="")
{
$force_signal = "-";
$imei_device = "-";
658,8 → 656,7
$gammu_status_off="";
}
 
echo "
<form action=\"autoregistration.php\" method=\"post\">
echo "<form action=\"autoregistration.php\" method=\"post\">
<table border=1>
<tr>
<td colspan=3><b>$l_conf</b></td>
666,21 → 663,11
<td><b>$l_conf_actu</b></td>
</tr>
<tr>
<td> $l_speed </td><td>
<select name=\"speed\">
<option value=\"at\">Auto</option>
<option value=\"9600\">9600 Bauds</option>
<option value=\"19200\">19200 Bauds</option>
<option value=\"115200\">115200 Bauds</option>
</select>
<td><button type=\"submit\" name=\"b_speed\">$l_edit</button></td>
<td><center><font color=\"green\">".$current_speed."</font></center></td>
<tr>
<td> $l_connect_port </td><td><select name=\"port\">'";
reset ($openned_ports);
while ( list(,$row) = each($openned_ports))
{
echo '<option value="'.$row.'">'.$row.'</option>';
echo '<option value="'.$row.'"';;if ("$row" == "$gammu_smsd_port") echo " selected";echo '>'.$row.'</option>';
echo $row." ";
}
echo "</select></td>
687,7 → 674,17
<td><button type=\"submit\" name=\"b_port\" $gammu_status_on>$l_edit</button></td>
<td><center><font color=\"green\">$gammu_smsd_port</font></center></td>
</tr>
<td> $l_speed </td><td>
<select name=\"speed\">
<option value=\"at\"";if ($current_speed == "at") echo " selected";echo ">Auto</option>
<option value=\"9600\"";if ($current_speed == "at9600") echo " selected"; echo ">9600 Bauds</option>
<option value=\"19200\"";if ($current_speed == "at19200") echo " selected"; echo ">19200 Bauds</option>
<option value=\"115200\"";if ($current_speed == "at115200") echo " selected";echo ">115200 Bauds</option>
</select>
<td><button type=\"submit\" name=\"b_speed\">$l_edit</button></td>
<td><center><font color=\"green\">".str_replace("at","",$current_speed);if ($current_speed == "at"){ echo "Auto"; } else { echo " Bauds";}echo "</font></center></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>
744,7 → 741,6
</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{
751,21 → 747,17
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>
<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 />
798,7 → 790,7
</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>
<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>