Subversion Repositories ALCASAR

Rev

Rev 2093 | Rev 2191 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2093 Rev 2182
Line 1... Line -...
1
<HTML>
-
 
2
<HEAD>
-
 
3
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-
 
4
<TITLE>Admin Logs</TITLE>
-
 
5
<link rel="stylesheet" href="../css/bootstrap.min.css">
-
 
6
<script src="../js/jquery.min.js"></script>
-
 
7
<script src="../js/bootstrap.min.js"></script>
-
 
8
<style>
-
 
9
 
-
 
10
body {
-
 
11
    background-color: #EFEFEF;
-
 
12
}
-
 
13
 
-
 
14
</style>
-
 
15
</HEAD>
-
 
16
<body>
-
 
17
 
-
 
18
<?php
1
<?php
19
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
-
 
20
{
-
 
21
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
-
 
22
	$Language = strtolower(substr(chop($Langue[0]),0,2)); 
-
 
23
}
-
 
24
 
-
 
25
if($Language == 'fr')
-
 
26
{
-
 
27
	$l_title_amdin_log="Connexion à l'ALCASAR Control Center (ACC)";
-
 
28
}
-
 
29
else
2
# $Id $
30
{
-
 
31
	$l_title_amdin_log="Connection to ALCASAR Control Center (ACC)";
-
 
32
}
-
 
33
 
3
 
34
echo '<center><h3>';
4
$Language = 'en';
35
echo "$l_title_amdin_log";
5
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
36
echo '</h3></center><div class="container"><table class="table table-striped">';
6
	$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
37
echo "<thead>";
7
	$Language = strtolower(substr(chop($Langue[0]), 0, 2)); 
38
echo "<tr>";
8
}
39
echo "<th>Date</th>";
-
 
-
 
9
 
40
echo "<th>User</th>";
10
if ($Language === 'fr') {
41
echo "<th>IP address</th>";
11
	$l_title_amdin_log = "Connexion à l'ALCASAR Control Center (ACC)";
42
echo "</tr>";
12
} else {
43
echo "</thead>";
13
	$l_title_amdin_log = "Connection to ALCASAR Control Center (ACC)";
44
echo "<tbody>";
14
}
45
 
15
 
-
 
16
// Read access log
-
 
17
$accessLogs = [];
46
$fichier='admin_log.txt';
18
$accessLogFilename = 'admin_log.txt';
47
$pointeur=fopen($fichier,"r");
19
$filePtn = fopen($accessLogFilename, 'r');
48
if ($pointeur){
20
if ($filePtn !== false){
49
	while (!feof($pointeur)){
21
	while (!feof($filePtn)) {
50
		$ligne=fgets($pointeur);
22
		$ligne = fgets($filePtn);
-
 
23
		if (empty($ligne)) {
-
 
24
			continue;
-
 
25
		}
51
		$infos=explode("|||",$ligne);
26
		$infos = explode('|||', $ligne);
52
		echo "<tr>";
27
		$accessLogs[] = (object) [
53
		echo "<td>$infos[0]</td>";	
28
			'date'     => trim($infos[0]),
54
		echo "<td>$infos[1]</td>";	
29
			'username' => trim($infos[1]),
55
		echo "<td>$infos[2]</td>";
30
			'ip'       => trim($infos[2])
56
		echo "</tr>";
31
		];
57
	}
32
	}
-
 
33
	fclose($filePtn);
58
}
34
}
59
else
-
 
60
{
-
 
61
	echo '<tr><center>Empty</center></tr>';
35
$accessLogs = array_reverse($accessLogs);
62
}
-
 
63
fclose($pointeur);
-
 
64
echo '</tbody></table></div>';
-
 
65
 
-
 
66
 
-
 
67
 
36
 
68
?>
37
?>
-
 
38
<!doctype html>
-
 
39
<html>
-
 
40
<head>
-
 
41
	<meta charset="utf-8">
-
 
42
	<title>Admin Logs</title>
-
 
43
	<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
-
 
44
	<style>
-
 
45
	body {
-
 
46
		background-color: #EFEFEF;
69
 
47
	}
-
 
48
	</style>
-
 
49
	<script src="../js/jquery.min.js"></script>
-
 
50
	<script src="../js/bootstrap.min.js"></script>
-
 
51
</head>
-
 
52
<body>
-
 
53
	<div class="container">
-
 
54
		<center>
-
 
55
			<h3><?= $l_title_amdin_log ?></h3>
-
 
56
		</center>
-
 
57
		<table class="table table-striped">
-
 
58
			<thead>
-
 
59
				<tr>
-
 
60
					<th>Date</th>
-
 
61
					<th>User</th>
-
 
62
					<th>IP address</th>
-
 
63
				</tr>
-
 
64
			</thead>
-
 
65
			<tbody>
-
 
66
				<?php if (empty($accessLogs)): ?>
-
 
67
					<tr>
-
 
68
						<td colspan="3"><center>Empty</center></td>
-
 
69
					</tr>
-
 
70
				<?php else: ?>
-
 
71
					<?php foreach ($accessLogs as $access): ?>
-
 
72
						<tr>
-
 
73
							<td><?= $access->date ?></td>
-
 
74
							<td><?= $access->username ?></td>
-
 
75
							<td><?= $access->ip ?></td>
-
 
76
						</tr>
-
 
77
					<?php endforeach; ?>
-
 
78
				<?php endif; ?>
-
 
79
			</tbody>
-
 
80
		</table>
-
 
81
	</div>
70
</body>
82
</body>
71
</HTML>
83
</html>
72
 
-