Subversion Repositories ALCASAR

Rev

Rev 2093 | Rev 2191 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2182 tom.houday 1
<?php
2
# $Id $
2093 raphael.pi 3
 
2182 tom.houday 4
$Language = 'en';
5
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
6
	$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
7
	$Language = strtolower(substr(chop($Langue[0]), 0, 2)); 
2093 raphael.pi 8
}
9
 
2182 tom.houday 10
if ($Language === 'fr') {
11
	$l_title_amdin_log = "Connexion à l'ALCASAR Control Center (ACC)";
12
} else {
13
	$l_title_amdin_log = "Connection to ALCASAR Control Center (ACC)";
2093 raphael.pi 14
}
15
 
2182 tom.houday 16
// Read access log
17
$accessLogs = [];
18
$accessLogFilename = 'admin_log.txt';
19
$filePtn = fopen($accessLogFilename, 'r');
20
if ($filePtn !== false){
21
	while (!feof($filePtn)) {
22
		$ligne = fgets($filePtn);
23
		if (empty($ligne)) {
24
			continue;
25
		}
26
		$infos = explode('|||', $ligne);
27
		$accessLogs[] = (object) [
28
			'date'     => trim($infos[0]),
29
			'username' => trim($infos[1]),
30
			'ip'       => trim($infos[2])
31
		];
2093 raphael.pi 32
	}
2182 tom.houday 33
	fclose($filePtn);
2093 raphael.pi 34
}
2182 tom.houday 35
$accessLogs = array_reverse($accessLogs);
2093 raphael.pi 36
 
37
?>
2182 tom.houday 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;
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>
2093 raphael.pi 82
</body>
2182 tom.houday 83
</html>