Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2552 → Rev 2553

/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("cat /etc/gammu_smsd_conf| grep port | cut -d ' ' -f3"); // Gammu_smsd listen port
$gammu_smsd_port=exec("sudo $script --port"); // Gammu_smsd listen port
while ( list(,$row) = each($openned_ports))
{
if ( "$row" == "$gammu_smsd_port" ) // is gammu listen on an openned port ?
276,7 → 276,6
?>
<center>
<br>
<form method="post" action="./autoregistration.php">
<table border=1 width=100%>
<tr>
<td colspan=2><h3><center><?php echo $l_status_device ?></center></h3></td>
283,10 → 282,11
</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)
if(isset($_GET["start"])){
if(isset($_POST["start"])){
$gammu_1=exec("sudo $script --start");
sleep(7);
if($current_last_secu!="")
315,7 → 315,7
header('Location: autoregistration.php');
exit();
}
if(isset($_GET["stop"])){
if(isset($_POST["stop"])){
exec("sudo $script --stop");
sleep(8);
header('Location: autoregistration.php');
322,20 → 322,20
exit();
}
# Set the speed connexion to MODEM
if(isset($_GET['b_speed'])){
echo "speed = ".$speed;
switch ($_GET['speed']) {
if(isset($_POST["b_speed"])){
$speed = $_POST["speed"];
switch ($speed) {
case "at":
exec("sudo $script --replace_connect ");
exec("sudo $script --replace_speed ");
break;
case "9600":
exec("sudo $script --replace_connect 9600");
exec("sudo $script --replace_speed 9600");
break;
case "19200":
exec("sudo $script --replace_connect 19200");
exec("sudo $script --replace_speed 19200");
break;
case "115200":
exec("sudo $script --replace_connect 115200");
exec("sudo $script --replace_speed 115200");
break;
}
//header('Location: autoregistration.php');
342,9 → 342,17
//exit();
}
# Set the com port
if(isset($_POST["b_port"])){
$port = $_POST["port"];
exec("sudo $script --replace_port ".escapeshellarg($port));
header('Location: autoregistration.php');
exit();
}
# Set the SIM phone number
if(isset($_GET["b_num_alcasar"])){
$num = $_GET["num_alcasar"];
if(isset($_POST["b_num_alcasar"])){
$num = $_POST["num_alcasar"];
$error_num_alcasar = "";
if($num !="")
{
366,8 → 374,8
}
# Set the SIM card PIN number
if(isset($_GET["b_pin"])){
$pin = $_GET["pin"];
if(isset($_POST["b_pin"])){
$pin = $_POST["pin"];
$error_pin = "";
if($pin !="")
{
389,8 → 397,8
}
 
# Set the number of tries before ban
if(isset($_GET["b_ban_temp"])){
$nb_ban_temp = $_GET["nb_essais"];
if(isset($_POST["b_ban_temp"])){
$nb_ban_temp = $_POST["nb_essais"];
$error_nb_essais = "";
if($nb_ban_temp !="")
{
412,8 → 420,8
}
 
# Set the session timeout for each new account
if(isset($_GET["b_time_account"])){
$time_account = $_GET["time_account"];
if(isset($_POST["b_time_account"])){
$time_account = $_POST["time_account"];
$error_time_account = "";
if($time_account !="")
{
435,8 → 443,8
}
 
# Set the ban timeout
if(isset($_GET["b_time_perm"])){
$time_perm = $_GET["time_perm"];
if(isset($_POST["b_time_perm"])){
$time_perm = $_POST["time_perm"];
$error_time_perm = "";
if($time_perm !="")
{
458,8 → 466,8
}
# removing a banned phone number
if(isset($_GET['num_select'])){
$numero=$_GET['num_select'];
if(isset($_POST['num_select'])){
$numero=$_POST['num_select'];
 
$add_mac=exec("sudo /usr/sbin/chilli_query list | grep ".escapeshellarg($numero)." | cut -d ' ' -f1");
if (!empty($add_mac)) {
471,14 → 479,14
}
 
# Edition etat pays
if(isset($_GET['country_select'])){
$country=utf8_decode($_GET['country_select']);
if(isset($_POST['country_select'])){
$country=utf8_decode($_POST['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'])){
if(isset($_POST['b_france_enable'])){
exec("sudo $script --change_country_dis_all");
exec("sudo $script --change_country France");
exec("sudo $script --change_country_filter fr");
485,7 → 493,7
header('Location: autoregistration.php');
exit();
}
if(isset($_GET['b_ue_enable'])){
if(isset($_POST['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){
496,13 → 504,13
header('Location: autoregistration.php');
exit();
}
if(isset($_GET["b_country_enable"])){
if(isset($_POST["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"])){
if(isset($_POST["b_country_disable"])){
exec("sudo $script --change_country_dis_all");
header('Location: autoregistration.php');
exit();
524,7 → 532,6
?>
</tr>
</table>
</form>
</center>
<br>
<?php
535,7 → 542,11
#$file_log = "gammu-smsd.log";
 
#Recuperation de la vitesse de connexion
$current_speed = exec("sudo $script --connect");
$current_speed = exec("sudo $script --speed");
$current_speed=str_replace("at","",$current_speed)." bauds";
if ($current_speed == " bauds") {
$current_speed = "Auto";
}
 
#Recuperation du code PIN actuel
$current_pin = exec("sudo $script --pin");
546,7 → 557,7
#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)
#Recuperation de la durée du ban perm (après flood)
$current_time_perm = exec("sudo $script --time_perm");
 
#Detection neméro de tel
570,8 → 581,7
#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=="")
if ($gammu_pid=="") # gammu_smsd is not started
{
$force_signal = "-";
$imei_device = "-";
648,7 → 658,8
$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>
658,12 → 669,12
<td> $l_speed </td><td>
<select name=\"speed\">
<option value=\"at\">Auto</option>
<option value=\"'9600\">9600 Bauds</option>
<option value=\"9600\">9600 Bauds</option>
<option value=\"19200\">19200 Bauds</option>
<option value=\"'115200\">115200 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\">".str_replace("at","",$current_speed)." Bauds</font></center></td>
<td><center><font color=\"green\">".$current_speed."</font></center></td>
<tr>
<td> $l_connect_port </td><td><select name=\"port\">'";
reset ($openned_ports);