loginCheck(OPEN_PROFILE_ADMINISTRATOR, false); // There are not logs in demo version require_once "../model/Query/Page/Access.php"; require_once "../lib/Form.php"; require_once "../lib/Search.php"; require_once "../lib/Check.php"; /** * Retrieving get vars */ $idUser = intval($_GET["id_user"]); $login = Check::safeText($_GET["login"]); $currentPage = isset($_GET["page"]) ? intval($_GET["page"]) : 1; /** * Search user accesses */ $accessQ = new Query_Page_Access(); $accessQ->setItemsPerPage(OPEN_ITEMS_PER_PAGE); $accessQ->searchUser($idUser, $currentPage); if ($accessQ->getRowCount() == 0) { $accessQ->close(); FlashMsg::add(sprintf(_("No logs for user %s."), $login)); header("Location: " . $returnLocation); exit; } /** * Show page */ $title = _("Access Logs"); require_once "../layout/header.php"; /** * Breadcrumb
unset($links); if ($day) { LogStats::hourly($table, $year, $month, $day); } elseif ($month) { LogStats::daily($table, $year, $month); } elseif ($year) { LogStats::monthly($table, $year); } else { LogStats::yearly($table); } if ($table == 'record') { include_once "../model/Query/Page/Record.php"; $logQ = new Query_Page_Record(); } else { include_once "../model/Query/Page/Access.php"; $logQ = new Query_Page_Access(); $profiles = array(OPEN_PROFILE_ADMINISTRATOR => _("Administrator"), OPEN_PROFILE_ADMINISTRATIVE => _("Administrative"), OPEN_PROFILE_DOCTOR => _("Doctor")); } if (!$logQ->select($year, $month, $day)) { $logQ->close(); echo Msg::info(_("No logs in this date.")); include_once "../layout/footer.php"; exit; } $thead = array(_("#"), _("Access Date"), _("Login")); if ($table == 'record') { $thead[] = _("Table"); $thead[] = _("Operation"); $thead[] = _("Data"); } else { $thead[] = _("Profile");
// deregister all current session variables FlashMsg::add(_("Your user account has been suspended. Contact with administrator to resolve this problem."), OPEN_MSG_WARNING); header("Location: ../home/index.php"); exit; } /** * Insert new session row with random token */ $sessionQ = new Query_Session(); $token = $sessionQ->getToken($user->getLogin()); $sessionQ->close(); unset($sessionQ); /** * Insert new user access */ $accessQ = new Query_Page_Access(); $accessQ->insert($user); $accessQ->close(); unset($accessQ); /** * Destroy form values and errors and reset sign on variables */ Form::unsetSession(); if (isset($_SESSION['auth']['last_login'])) { unset($_SESSION['auth']['last_login']); // is not yet necessary (temporary value) } if (isset($_SESSION['auth']['login_attempts'])) { unset($_SESSION['auth']['login_attempts']); // is not yet necessary (temporary value) }