1,5 → 1,4 |
<?php |
|
#Define |
$gammu_wrong_port = ""; |
$gammu_puk = ""; |
22,25 → 21,20 |
|
# 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 |
while ( list(,$row) = each($openned_ports)) |
{ |
if ( "$row" == "$gammu_smsd_port" ) // is gammu listen on an openned port ? |
{ |
foreach($openned_ports as $row) { |
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'); |
278,7 → 272,6 |
} |
|
$(document).ready( function () { |
|
$('#table_id').DataTable({ |
"language": { |
"paginate": { |
294,7 → 287,6 |
"sSearch": "<?php echo $l_tab_search; ?>" |
} |
}); |
|
$('#table_country').DataTable({ |
"language": { |
"paginate": { |
348,32 → 340,25 |
</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"); |
} |
} |
421,21 → 406,17 |
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; |
} |
} |
444,21 → 425,17 |
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; |
} |
} |
467,21 → 444,17 |
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; |
} |
} |
490,21 → 463,17 |
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; |
} |
} |
513,29 → 482,24 |
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)); |
546,7 → 510,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"); |
553,7 → 517,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"); |
560,40 → 524,36 |
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); |
while ( list(,$row) = each($openned_ports)) |
{ |
foreach ($openned_ports as $row) { |
echo $row." "; |
} |
echo '</b></td>'; |
} |
else |
{ |
else { |
echo "<td>$l_key_diseable</td>"; |
} |
?> |
603,8 → 563,7 |
<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"; |
|
645,20 → 604,15 |
$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>"; |
} |
} |
667,54 → 621,38 |
$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>"; |
} |
} |
721,7 → 659,6 |
$gammu_status_on="disabled"; |
$gammu_status_off=""; |
} |
|
echo "<form action=\"user_by_sms.php\" method=\"post\"> |
<table border=1> |
<tr> |
731,8 → 668,7 |
<tr> |
<td> $l_connect_port </td><td><select name=\"port\">'"; |
reset ($openned_ports); |
while ( list(,$row) = each($openned_ports)) |
{ |
foreach ($openned_ports as $row) { |
echo '<option value="'.$row.'"';;if ("$row" == "$gammu_smsd_port") echo " selected";echo '>'.$row.'</option>'; |
echo $row." "; |
} |
805,26 → 741,21 |
$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;"> |
868,26 → 799,21 |
</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> |
903,14 → 829,10 |
</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> |
922,26 → 844,22 |
</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\"> |
<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> |
<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='submit' value='".$l_num_unlock."'> |
</td> |
</form> |