1,27 → 1,19 |
<!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>Activity</title> |
<link rel="stylesheet" href="/css/style.css"> |
</head> |
<body> |
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
<? |
<?php |
/******************** |
* READ CONF FILES * |
*********************/ |
define ("CONF_FILE", "/usr/local/etc/alcasar.conf"); |
define ("ETHERS_INFO_FILE", "/usr/local/etc/alcasar-ethers-info"); |
define("CONF_FILE", "/usr/local/etc/alcasar.conf"); |
define("ETHERS_INFO_FILE", "/usr/local/etc/alcasar-ethers-info"); |
$conf_files=array(CONF_FILE,ETHERS_INFO_FILE); |
foreach ($conf_files as $file){ |
if (!file_exists($file)){ |
exit("Requested file ".$file." isn't present");} |
if (!is_readable($file)){ |
exit("Can't read the file ".$file);} |
foreach ($conf_files as $file) { |
if (!file_exists($file)) { |
exit("Requested file ".$file." isn't present"); |
} |
if (!is_readable($file)) { |
exit("Can't read the file ".$file); |
} |
} |
#retrieve IP_address of ALCASAR |
|
$alcasar_conf_file = '/usr/local/etc/alcasar.conf'; |
$file_conf = fopen($alcasar_conf_file, 'r'); |
if (!$file_conf) { |
42,40 → 34,38 |
require('/etc/freeradius-web/config.php'); |
# 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_activity = "Activité sur le réseau de consultation"; |
$l_ip_adr = "Adresse IP"; |
$l_mac_adr = "Adresse MAC"; |
$l_user = "Usager"; |
$l_mac_allowed = "@MAC autorisée"; |
$l_mac_temporarily_allowed = "@MAC autorisée temporairement"; |
$l_action = "Action"; |
$l_dissociate = "Dissocier @IP"; |
$l_disconnect = "Déconnecter"; |
$l_refresh = "Cette page est rafraichie toutes les 30 secondes"; |
$l_edit_user = "Editer l'utilisateur"; |
$l_connect = "Autoriser temporairement"; |
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); |
$Language = strtolower(substr(chop($Langue[0]), 0, 2)); |
} |
else { |
$l_activity = "Activity on the consultation LAN"; |
$l_ip_adr = "IP Adress"; |
$l_mac_adr = "MAC Adress"; |
$l_user = "User"; |
$l_mac_allowed = "@MAC allowed"; |
$l_mac_temporarily_allowed = "@MAC temporarily allowed"; |
$l_action = "Action"; |
$l_dissociate = "Dissociate @IP"; |
$l_disconnect = "Disconnect"; |
$l_refresh = "This frame is refreshed every 30'"; |
$l_edit_user = "Edit user"; |
$l_connect = "Temporarily authorize"; |
if ($Language === 'fr') { |
$l_activity = "Activité sur le réseau de consultation"; |
$l_ip_adr = "Adresse IP"; |
$l_mac_adr = "Adresse MAC"; |
$l_user = "Usager"; |
$l_mac_allowed = "@MAC autorisée"; |
$l_mac_temporarily_allowed = "@MAC autorisée temporairement"; |
$l_action = "Action"; |
$l_dissociate = "Dissocier @IP"; |
$l_disconnect = "Déconnecter"; |
$l_refresh = "Cette page est rafraichie toutes les 30 secondes"; |
$l_edit_user = "Editer l'utilisateur"; |
$l_connect = "Autoriser temporairement"; |
} else { |
$l_activity = "Activity on the consultation LAN"; |
$l_ip_adr = "IP Adress"; |
$l_mac_adr = "MAC Adress"; |
$l_user = "User"; |
$l_mac_allowed = "@MAC allowed"; |
$l_mac_temporarily_allowed = "@MAC temporarily allowed"; |
$l_action = "Action"; |
$l_dissociate = "Dissociate @IP"; |
$l_disconnect = "Disconnect"; |
$l_refresh = "This frame is refreshed every 30'"; |
$l_edit_user = "Edit user"; |
$l_connect = "Temporarily authorize"; |
} |
echo "<tr><th>$l_activity</th></tr> |
<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=\"1\" height=\"2\"></td></tr> |
</table>"; |
|
if (isset($_POST['action'])){ |
switch ($_POST['action']){ |
case "$l_disconnect" : |
93,16 → 83,30 |
} |
} |
?> |
<!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>Activity</title> |
<link rel="stylesheet" type="text/css" href="/css/style.css"> |
</head> |
<body> |
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
<tr><th><?= $l_activity ?></th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr> |
</table> |
<table width="100%" border=1 cellspacing=0 cellpadding=1> |
<tr><td valign="middle" align="center"><? echo "$l_refresh";?><br> |
<table border=1 width="80%" bordercolordark="#ffffe0" bordercolorlight="#000000" cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top> |
<tr bgcolor="#d0ddb0"> |
<? echo " <th>#</th> |
<th>$l_ip_adr</th> |
<th>$l_mac_adr</th> |
<th>$l_user</th> |
<th>$l_action</th> |
</tr>"; |
<tr><td valign="middle" align="center"><?= $l_refresh ?><br> |
<table border=1 width="80%" cellpadding=2 cellspacing=0> |
<tr> |
<th>#</th> |
<th><?= $l_ip_adr ?></th> |
<th><?= $l_mac_adr ?></th> |
<th><?= $l_user ?></th> |
<th><?= $l_action ?></th> |
</tr> |
<?php |
$output = array(); $detail = array(); $nb_ligne = 0; |
exec("sudo /sbin/ip link show ".escapeshellarg($intif), $output); // retrieve ALCASAR MAC address |
$detail = explode (" " , $output[1]); |
157,9 → 161,9 |
else { #MAC is temporarily allowed |
echo "<b>$l_mac_temporarily_allowed</b>"; |
echo "</td><td>"; |
echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>"; |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>"; |
echo "<INPUT type=submit name='action' value='$l_disconnect'>"; |
echo "<FORM action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">"; |
echo "<INPUT type=\"hidden\" name=\"mac_addr\" value=\"$detail[0]\">"; |
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_disconnect\">"; |
echo "</FORM></TD>"; |
} |
# Disable temporarily @MAC access |
169,9 → 173,9 |
if ($cn != '-') { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5] ($cn)</a>";} |
else { echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"$l_edit_user $detail[5]\">$detail[5]</a>";} |
echo "<TD>"; |
echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>"; |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>"; |
echo "<INPUT type=submit name='action' value='$l_disconnect'>"; |
echo "<FORM action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">"; |
echo "<INPUT type=\"hidden\" name=\"mac_addr\" value=\"$detail[0]\">"; |
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_disconnect\">"; |
echo "</FORM></TD>"; |
} |
} |
185,15 → 189,15 |
else { |
echo " "; |
echo "<TD>"; |
echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>"; |
echo "<FORM action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">"; |
# Dissociate user (... or other) who is not connected yet |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>"; |
echo "<INPUT type=\"hidden\" name=\"mac_addr\" value=\"$detail[0]\">"; |
exec ("grep $detail[0] /usr/local/etc/alcasar-ethers-info", $mac_in_ether_file); |
if (empty($mac_in_ether_file[1])) |
{ |
echo "<INPUT type='submit' name='action' value='$l_dissociate'>"; // Dissociate only MAC not in ether file (dhcp) |
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_dissociate\">"; // Dissociate only MAC not in ether file (dhcp) |
} |
echo "<INPUT type=submit name='action' value='$l_connect'>"; // Enable temporarily @MAC access |
echo "<INPUT type=\"submit\" name=\"action\" value=\"$l_connect\">"; // Enable temporarily @MAC access |
echo "</FORM></TD>"; |
} |
unset ($mac_in_ether_file); |