4,7 → 4,54 |
# by steweb57 |
# |
$organisme = ""; |
$remote_ip = ($_SERVER['REMOTE_ADDR']); |
$connection_history = ""; |
$nb_connection_history = 3; |
|
//On récupère le nom de connexion de la session active. //on a l'info en ajax, mais trop tard -> A MODIFIER |
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab); |
$user = explode (" ", $tab[0]); |
|
#### Affichage des 3 dernières connexions de $user[5] |
function secondsToDuration($seconds = null){ |
if ($seconds == null) return ""; |
|
$temp = $seconds % 3600; |
$time[0] = ( $seconds - $temp ) / 3600 ; // hours |
$time[2] = $temp % 60 ; // seconds |
$time[1] = ( $temp - $time[2] ) / 60; // minutes |
|
return $time[0]." h ".$time[2]." m ".$time[1]." s"; |
} |
|
$l_connected = "connected"; // a traduire (choix de la langue ci-dessous mais nécessitant de $connection_history) |
// si on a pas d'accès à la bdd, la page s'affiche quand même correctement |
if (isset($user[5])){ |
if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){ |
include_once("/etc/freeradius-web/config.php"); |
include_once("./acc/manager/lib/sql/drivers/mysql/functions.php"); |
|
$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history"; |
$link = @da_sql_pconnect($config); // on affiche pas les erreurs |
|
if ($link){ |
$res = @da_sql_query($link,$config,$sql); // on affiche pas les erreurs |
|
if ($res){ |
$connection_history.= "<ul>"; |
while(($row = @da_sql_fetch_array($res,$config))){ |
$connected = ""; |
if ($row[acctstoptime] == "") $connected = " ($l_connected)"; |
$connection_history.="<li title='$row[username] $row[acctstarttime] $row[acctstoptime] (".secondsToDuration($row[acctsessiontime]).")'>$row[acctstarttime] (".secondsToDuration($row[acctsessiontime]).") $connected</li>"; |
} |
$connection_history.="</ul>"; |
} |
} |
} |
} |
#### |
|
|
# Choice of language |
//reste quelques traductions à faire |
$Language = 'en'; |
32,6 → 79,7 |
$l_na = "N/A"; //à traduire |
$l_error = "error"; //à traduire |
$l_welcome = "Welcome"; //à traduire |
$l_conn_history = "$nb_connection_history last connections"; //à traduire |
} |
else if($Language == 'de'){ |
$l_login1 = "Erfolgreiche Authentifizierung."; |
54,6 → 102,7 |
$l_na = "N/A"; //à traduire |
$l_error = "error"; //à traduire |
$l_welcome = "Welcome"; //à traduire |
$l_conn_history = "$nb_connection_history last connections"; //à traduire |
} |
else if($Language == 'nl'){ |
$l_login1 = "Succesvolle authenticatie."; |
76,6 → 125,7 |
$l_na = "N/A"; //à traduire |
$l_error = "error"; //à traduire |
$l_welcome = "Welcome"; //à traduire |
$l_conn_history = "$nb_connection_history last connections"; //à traduire |
} |
else if($Language == 'fr'){ |
$l_login1 = "Authentification réussie."; |
98,6 → 148,7 |
$l_na = "N/D"; //à traduire |
$l_error = "erreur"; |
$l_welcome = "Bienvenue"; |
$l_conn_history = "$nb_connection_history dernières connexions"; |
} |
else { |
$l_login1 = "Successful authentication."; |
120,6 → 171,7 |
$l_na = "N/A"; |
$l_error = "error"; |
$l_welcome = "Welcome"; |
$l_conn_history = "$nb_connection_history last connections"; |
} |
?> |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
199,9 → 251,13 |
<td id="outputOctetsLabel" class="chilliLabel"><strong><?php echo $l_uploaded_label; ?></strong></td> |
<td id="outputOctets" class="chilliValue"><?php echo $l_na; ?></td> |
</tr> |
<tr id="originalURLRow"> |
<!--tr id="originalURLRow"> |
<td id="originalURLLabel" class="chilliLabel"><strong><?php echo $l_original_url_label; ?></strong></td> |
<td id="originalURL" class="chilliValue"><?php echo $l_na; ?></td> |
</tr--> |
<tr id="conHistoryRow"> |
<td id="conHistoryLabel" class="chilliLabel"><strong><?php echo $l_conn_history; ?></strong></td> |
<td id="conHistory" class="chilliValue"><?php echo $connection_history; ?></td> |
</tr> |
</table> |
</div> |