4 // by Mischa Peters <mischa at high5 dot nl>
5 // Copyright (c) 2022 High5!
6 // License Info: LICENSE.TXT
10 // Template File: viewlog.tpl
12 // Template Variables:
16 // POST / GET Variables:
20 require_once './functions.inc.php';
21 include './languages/' . check_language() . '.lang';
23 $SESSID_USERNAME = check_session();
24 $ROLE = check_role($SESSID_USERNAME);
26 if ($ROLE == ADMIN_ROLE) {
27 $list_domains = list_domains();
29 $list_domains = list_domains($SESSID_USERNAME);
32 if ($_SERVER['REQUEST_METHOD'] == "GET") {
33 $domain = filter_input(INPUT_GET, 'domain', FILTER_VALIDATE_DOMAIN);
36 if (empty($domain) && count($list_domains) > 0) {
37 $domain = $list_domains[0]['domain'];
40 if (in_array($domain, array_column($list_domains, 'domain'))) {
41 $domain_key = array_search($domain, array_column($list_domains, 'domain'));
43 $sth = $dbh->prepare("SELECT * FROM log WHERE domain=? ORDER BY timestamp DESC LIMIT ?");
44 $sth->bindParam(1, $domain, PDO::PARAM_STR);
45 $sth->bindParam(2, $limit, PDO::PARAM_INT);
47 $log = $sth->fetchAll();
50 include './templates/header.tpl';
51 include './templates/menu.tpl';
52 include './templates/viewlog.tpl';
53 include './templates/footer.tpl';