-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.php
35 lines (29 loc) · 1.15 KB
/
report.php
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
<?php
require_once(__DIR__ . '/../../config.php');
// Ensure this script is accessed within Moodle.
defined('MOODLE_INTERNAL') || die();
// Require the user to be logged in.
require_login();
$PAGE->set_url(new moodle_url('/auth/faceauth/report.php'));
$PAGE->set_context(context_system::instance());
$PAGE->set_title(get_string('faceauthreport', 'auth_faceauth'));
// Query to fetch face authentication logs.
$logs = $DB->get_records('auth_faceauth_logs', null, 'attempt_time DESC');
// Output the header.
echo $OUTPUT->header();
// Display the report.
echo '<h2>' . get_string('faceauthreport', 'auth_faceauth') . '</h2>';
echo '<table class="generaltable">';
echo '<tr><th>User ID</th><th>Status</th><th>Attempt Time</th><th>IP Address</th><th>Error Message</th></tr>';
foreach ($logs as $log) {
echo '<tr>';
echo '<td>' . $log->userid . '</td>';
echo '<td>' . $log->status . '</td>';
echo '<td>' . userdate($log->attempt_time) . '</td>';
echo '<td>' . $log->ip_address . '</td>';
echo '<td>' . $log->error_message . '</td>';
echo '</tr>';
}
echo '</table>';
// Output the footer.
echo $OUTPUT->footer();