* * 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 in GPL.txt for more details. */ // PHP <5.5 compatibility require_once('../includes/password.php'); session_start(); if (isset($_SESSION['login'])) { // Do nothing } else { header("Location: ."); exit(); } if (isset($_GET['logout'])) { if (isset($_SESSION['login'])) unset($_SESSION['login']); session_destroy(); header("Location: ."); exit(); } $date = date('jS F Y'); $ip = $_SERVER['REMOTE_ADDR']; require_once('../config.php'); $conn = new PDO( "mysql:host=$db_host;dbname=$db_schema;charset=utf8", $db_user, $db_pass, $db_opts ); $query = "SELECT @last_id := MAX(id) FROM admin_history"; $query = $conn->query('SELECT @last_id := MAX(id) FROM admin_history'); while ($row = $query->fetch()) { $last_id = $row['@last_id := MAX(id)']; } $query = $conn->prepare('SELECT ip, last_date FROM admin_history WHERE id = ?'); $query->execute([$last_id]); while ($row = $query->fetch()) { $last_date = $row['last_date']; $last_ip = $row['ip']; } /* This seems to take the same path in both cases and be overly convoluted, so I rewrote it below but kept this in case I * am missing something... if ($last_ip == $ip) { if ($last_date == $date) { } else { $query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')"; mysqli_query($con, $query); } } else { $query = "INSERT INTO admin_history (last_date,ip) VALUES ('$date','$ip')"; mysqli_query($con, $query); }*/ if ($last_ip !== $ip || $last_date !== $date) { $conn->prepare('INSERT INTO admin_history (ip, last_date) VALUES (?, ?)')->execute([$date, $ip]); } $query = $conn->query('SELECT user, pass FROM admin'); while ($row = $query->fetch()) { $adminid = Trim($row['user']); $password = Trim($row['pass']); } ?> Paste - Admin Settings
' . mysqli_error($con) . '
'; } else { $msg = '
Account details updated.
'; } } ?>
query('SELECT COUNT(*) FROM admin_history'); $row = $query->fetch(PDO::FETCH_NUM); $rec_count = $row[0]; $query = $conn->prepare('SELECT ip, last_date FROM admin_history ORDER BY `id` LIMIT ?'); $query->execute([$rec_limit]); while ($row = $query->fetch()) { echo ''; echo ''; echo ''; echo ''; } ?>
Login date IP
' . $row['last_date'] . '' . $row['ip'] . '