Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 3076 → Rev 3072

/web/acc/manager/htdocs/activity.php
179,7 → 179,7
$intif_mac_addr=strtoupper(str_replace(":","-",$detail[5]));
unset ($output);unset ($detail);
exec ('sudo /usr/sbin/chilli_query list|sort -k5 -r', $output);
foreach($output as $ligne){
while (list(,$ligne) = each($output)){
$detail = explode (" ", $ligne);
$nb_ligne ++;
echo "<tr valign=\"middle\">";
284,7 → 284,7
}
if ($conf['MULTIWAN'] !== 'off') {
if ($detail[4] == "1"){ // authenticated user
foreach ($list_ip_gw as $ligne2){
while (list(,$ligne2) = each($list_ip_gw)){
$detail2 = explode (" ", $ligne2);
if ($detail2[0] == $detail[1]){
echo "<td>$detail2[1]</td>";
/web/acc/manager/htdocs/user_by_sms.php
1,4 → 1,5
<?php
 
#Define
$gammu_wrong_port = "";
$gammu_puk = "";
21,20 → 22,25
 
# Test if a modem is plugged on serial-usb port
$open_port=exec("ls /dev/ttyUSB*",$openned_ports); // list of USB-Serial ports openned by a modem
if (!empty($open_port)) {
if (!empty($open_port))
{
$find_key="true";
$vendor=exec("udevadm info -n $openned_ports[0] | grep 'MODEL=' | cut -d'=' -f2");
$model=exec("udevadm info -n $openned_ports[0] | grep 'MODEL_FROM_DATABASE=' | cut -d'=' -f2");
$gammu_smsd_port=exec("cat /etc/gammu_smsd_conf| grep '^port\s\?=' | cut -d ' ' -f3"); // Gammu_smsd listen port
foreach($openned_ports as $row) {
if ( "$row" == "$gammu_smsd_port" ) { // is gammu listen on an openned port ?
while ( list(,$row) = each($openned_ports))
{
if ( "$row" == "$gammu_smsd_port" ) // is gammu listen on an openned port ?
{
$listen_on_right_port="true";
}
}
}
$gammu_pid=exec("sudo $script --pidof");
if ($find_key == "false") { # close gammu if it's started
if ($gammu_pid!="") {
if ($find_key == "false")
{ # close gammu if it's started
if ($gammu_pid!="")
{
exec("sudo $script --stop");
sleep(8);
header('Location: user_by_sms.php');
272,6 → 278,7
}
 
$(document).ready( function () {
 
$('#table_id').DataTable({
"language": {
"paginate": {
287,6 → 294,7
"sSearch": "<?php echo $l_tab_search; ?>"
}
});
 
$('#table_country').DataTable({
"language": {
"paginate": {
340,25 → 348,32
</tr>
<tr>
<?php
if($find_key=="true") {
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($_POST["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)) {
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)) {
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)) {
if($current_last_secu!="")
{
if(($current_last_secu > $current_last_start) && ($current_last_secu > $current_last_stop))
{
exec("sudo $script --stop");
}
}
406,17 → 421,21
echo "speed = ".$_POST['num_alcasar'];
$num = $_POST["num_alcasar"];
$error_num_alcasar = "";
if($num !="") {
if(preg_match('#^\+#',$num)) {
if($num !="")
{
if(preg_match('#^\+#',$num))
{
exec("sudo $script --replace_numero_alcasar ".escapeshellarg($num));
header('Location: user_by_sms.php');
exit();
}
else {
else
{
$error_num_alcasar=$l_error_label_num3;
}
}
else {
else
{
$error_num_alcasar=$l_error_label_empty;
}
}
425,17 → 444,21
if(isset($_POST["b_pin"])){
$pin = $_POST["pin"];
$error_pin = "";
if($pin !="") {
if(is_numeric($pin)) {
if($pin !="")
{
if(is_numeric($pin))
{
exec("sudo $script --replace_pin ".escapeshellarg($pin));
header('Location: user_by_sms.php');
exit();
}
else {
else
{
$error_pin=$l_error_label_num;
}
}
else {
else
{
$error_pin=$l_error_label_empty;
}
}
444,17 → 467,21
if(isset($_POST["b_time_account"])){
$time_account = $_POST["time_account"];
$error_time_account = "";
if($time_account !="") {
if(is_numeric($time_account)) {
if($time_account !="")
{
if(is_numeric($time_account))
{
exec("sudo $script --replace_time_account ".escapeshellarg($time_account));
header('Location: user_by_sms.php');
exit();
}
else {
else
{
$error_time_account=$l_error_label_num2;
}
}
else {
else
{
$error_time_account=$l_error_label_empty;
}
}
463,17 → 490,21
if(isset($_POST["b_ban_temp"])){
$nb_ban_temp = $_POST["nb_essais"];
$error_nb_essais = "";
if($nb_ban_temp !="") {
if(is_numeric($nb_ban_temp)) {
if($nb_ban_temp !="")
{
if(is_numeric($nb_ban_temp))
{
exec("sudo $script --replace_try_ban ".escapeshellarg($nb_ban_temp));
header('Location: user_by_sms.php');
exit();
}
else {
else
{
$error_nb_essais=$l_error_label_num2;
}
}
else {
else
{
$error_nb_essais=$l_error_label_empty;
}
}
482,24 → 513,29
if(isset($_POST["b_time_perm"])){
$time_perm = $_POST["time_perm"];
$error_time_perm = "";
if($time_perm !="") {
if(is_numeric($time_perm)) {
if($time_perm !="")
{
if(is_numeric($time_perm))
{
exec("sudo $script --replace_time_perm ".escapeshellarg($time_perm));
header('Location: user_by_sms.php');
exit();
}
else {
else
{
$error_time_perm=$l_error_label_num2;
}
}
else {
else
{
$error_time_perm=$l_error_label_empty;
}
}
# removing a banned phone number
if(isset($_POST['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)) {
exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($add_mac));
510,7 → 546,7
}
 
# Edition etat pays
if(isset($_POST['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");
517,7 → 553,7
header('Location: user_by_sms.php');
exit();
}
if(isset($_POST['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");
524,36 → 560,40
header('Location: user_by_sms.php');
exit();
}
if(isset($_POST['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){
exec("sudo $script --change_country ".escapeshellarg($pays));
}
exec("sudo $script --change_country_filter ue");
header('Location: user_by_sms.php');
exit();
}
if(isset($_POST["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: user_by_sms.php');
exit();
}
if(isset($_POST["b_country_disable"])) {
if(isset($_POST["b_country_disable"])){
exec("sudo $script --change_country_dis_all");
header('Location: user_by_sms.php');
exit();
}
 
echo ' <td>'.$l_key_enable_1;
echo '<br>'.$l_key_enable_2.'<b>';
reset ($openned_ports);
foreach ($openned_ports as $row) {
while ( list(,$row) = each($openned_ports))
{
echo $row." ";
}
echo '</b></td>';
}
else {
else
{
echo "<td>$l_key_diseable</td>";
}
?>
563,7 → 603,8
<br>
<?php
 
if ($find_key=="true") {
if ($find_key=="true")
{
#Nom du fichier de log lorsque gammu est démarré
#$file_log = "gammu-smsd.log";
 
604,15 → 645,20
$current_last_timeout = exec("sudo $script --last_timeout");
# Test si le service est lancé
if ($gammu_pid=="") {
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)) {
 
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>";
}
}
621,38 → 667,54
$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 ($listen_on_right_port != "true") {
if ($listen_on_right_port != "true"){
$gammu_wrong_port="<tr><td colspan=7><font color=red>$l_error_wrong_port</font></td></tr>";
}
if($current_last_timeout!="") {
if(($current_last_timeout > $current_last_start) && ($current_last_timeout > $current_last_stop)) {
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)) {
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)) {
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)) {
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>";
}
}
659,6 → 721,7
$gammu_status_on="disabled";
$gammu_status_off="";
}
 
echo "<form action=\"user_by_sms.php\" method=\"post\">
<table border=1>
<tr>
668,7 → 731,8
<tr>
<td> $l_connect_port </td><td><select name=\"port\">'";
reset ($openned_ports);
foreach ($openned_ports as $row) {
while ( list(,$row) = each($openned_ports))
{
echo '<option value="'.$row.'"';;if ("$row" == "$gammu_smsd_port") echo " selected";echo '>'.$row.'</option>';
echo $row." ";
}
741,21 → 805,26
$gammu_writeerror
</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 {
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()) {
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;">
799,21 → 868,26
</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=\"user_by_sms.php\" method=\"post\">
<td>
<input type=\"hidden\" name=\"country_select\" value=\"" .$row['name']."\">
".$row['name']."
</td>
<td>".$row['id']."</td>
";
if($row['status']=='0') {
while($row = mysqli_fetch_array($result_country))
{
echo "
<tr>
<form action=\"user_by_sms.php\" method=\"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') {
if($row['status']=='1')
{
echo "<td><input type='image' src=\"/images/state_ok.gif\" width=\"15\" height=\"15\"></td>";
}
echo " </form>
829,10 → 903,14
</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>
844,22 → 922,26
</thead>
<tbody>
<?php
while($row = mysqli_fetch_array($result)) {
echo "
while($row = mysqli_fetch_array($result))
{
echo "
<tr>
<form action=\"user_by_sms.php\" method=\"post\">
<form action=\"user_by_sms.php\" method=\"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=\"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>
/web/acc/manager/lib/sql/drivers/mysql/functions.php
96,15 → 96,14
 
function da_sql_fetch_array($result,$config)
{
while($fetch=mysqli_fetch_array($result,MYSQLI_ASSOC)){
$row = @array_change_key_case($fetch,CASE_LOWER);
if ($config['sql_debug'] == 'true'){
print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: <pre>";
print_r($row);
print "</b></pre>\n";
}
return $row;
$row = @array_change_key_case(mysqli_fetch_array($result,
MYSQLI_ASSOC),CASE_LOWER);
if ($config['sql_debug'] == 'true'){
print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: <pre>";
print_r($row);
print "</b></pre>\n";
}
return $row;
}
 
function da_sql_affected_rows($link,$result,$config)