} $recentQuery->close(); } /* close connection */ $mysqli->close(); return $recentArray['year_id']; } /* * isNull function */ function isNull($data) { if (is_null($data)) { return "<span style='opacity: 0.3;''>Org Not Registered Yet</span>"; } else { return $data; } } /*************************************************** *************************************************** NOT FUNCTIONS --- CODE TO RUN ON EVERY PAGE *************************************************** ***************************************************/ // Logout user if logged in passed certain amount of time if (isLoggedIn() && auto_logout()) { session_destroy(); session_start(); $_SESSION['feedback'] = ['color' => 'yellow', 'message' => 'Session timed out. Please login again.']; header("Location: /redirect.html"); die; }
<?php //echo getHostName(); //$pusherIP='52.90.77.67'; if (auto_logout("user_time")) { session_unset(); session_destroy(); session_start(); $_SESSION["user_time"] = time(); } $pusherIP = '172.24.18.10'; $pusherIP = '192.168.0.106'; $pusherIP = getHostByName(getHostName()); //$pusherIP='52.90.77.67'; $servername = "localhost"; $username = "******"; $password = "******"; $dbname = "MyHoot"; //mysqladmin -u root -p'MyHoot' password myhoot // Create connection $conn = new mysqli($servername, $username, $password, $dbname); $conn->set_charset("utf8mb4"); $conn->query("SET collation_connection = utf8mb4_unicode_ci"); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } include "controller/siteFunctions.php"; // An array of $_POST keys that are acceptable if (isset($whitelist)) { foreach ($whitelist as $key) {
function auto_logout() { if (!isset($_SESSION["user_time"])) { $_SESSION["user_time"] = time(); return false; } $t = time(); $t0 = $_SESSION["user_time"]; $diff = $t - $t0; if ($diff > 6000 || !isset($t0)) { return true; } else { $_SESSION["user_time"] = time(); } } if (auto_logout()) { session_unset(); session_destroy(); session_start(); $_SESSION['feedback'] = ['message' => 'Session Timeout... Please Login Again To Continue Budgeting.']; header('Location: ../index.php'); exit; } ?> <!-- Navigation --> <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"></button> <a class="navbar-brand lighten-DU" href="index.php">bu<span>DU</span>get</a>