-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogs_access.php
More file actions
80 lines (73 loc) · 2.68 KB
/
logs_access.php
File metadata and controls
80 lines (73 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/*
Gibbon, Flexible & Open School System
Copyright (C) 2010, Ross Parker
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@session_start() ;
//Module includes
include "./modules/" . $_SESSION[$guid]["module"] . "/moduleFunctions.php" ;
if (isModuleAccessible($guid, $connection2)==FALSE) {
//Acess denied
print "<div class='error'>" ;
print "You do not have access to this action." ;
print "</div>" ;
}
else {
//New PDO DB connection.
//Gibbon uses PDO to connect to databases, rather than the PHP mysql classes, as they provide paramaterised connections, which are more secure.
try {
$connection2=new PDO("mysql:host=$databaseServer;dbname=$databaseName;charset=utf8", $databaseUsername, $databasePassword);
$connection2->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$connection2->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
}
catch(PDOException $e) {
echo $e->getMessage();
}
}
try{
$sql = "SELECT * FROM gibbonLog";
$result = $pdo->query($sql);
if($result->rowCount() > 0){
echo "<table>";
echo "<tr>";
echo "<th>gibbonLogID</th>";
echo "<th>gibbonPersonID</th>";
echo "<th>gibbonSchoolYearID</th>";
echo "<th>timestamp</th>";
echo "<th>title</th>";
echo "<th>serialisedArray</th>";
echo "<th>ip</th>";
echo "</tr>";
while($row = $result->fetch()){
echo "<tr>";
echo "<td>" . $row['gibbonLogID'] . "</td>";
echo "<td>" . $row['gibbonPersonID'] . "</td>";
echo "<td>" . $row['gibbonSchoolYearID'] . "</td>";
echo "<td>" . $row['timestamp'] . "</td>";
echo "<td>" . $row['title'] . "</td>";
echo "<td>" . $row['serialisedArray'] . "</td>";
echo "<td>" . $row['ip'] . "</td>";
echo "</tr>";
}
echo "</table>";
// Free result set
unset($result);
} else{
echo "No records matching your query were found.";
}
} catch(PDOException $e){
die("ERROR: Could not able to execute $sql. " . $e->getMessage());
}
// Close connection
unset($pdo);
?>