*
* 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.
*/
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();
}
$today_users_count = 0;
$today_pastes_count = 0;
$date = date('jS F Y');
$ip = $_SERVER['REMOTE_ADDR'];
require_once('../config.php');
require_once('../includes/functions.php');
$con = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbname);
if (mysqli_connect_errno()) {
$sql_error = mysqli_connect_error();
die("Unable connect to database");
}
$query = "SELECT @last_id := MAX(id) FROM admin_history";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
$last_id = $row['@last_id := MAX(id)'];
}
$query = "SELECT * FROM admin_history WHERE id=" . Trim($last_id);
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
$last_date = $row['last_date'];
$last_ip = $row['ip'];
}
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);
}
$query = "SELECT * FROM page_view";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
$total_page = isset($total_page) + Trim($row['tpage']);
$total_visit = isset($total_visit) + Trim($row['tvisit']);
}
$query = "SELECT @last_id := MAX(id) FROM page_view";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
$page_last_id = $row['@last_id := MAX(id)'];
}
$query = "SELECT * FROM page_view WHERE id=" . Trim($page_last_id);
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
$today_page = $row['tpage'];
$today_visit = $row['tvisit'];
}
$query = "SELECT * FROM site_info";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
$admin_email = Trim($row['email']);
}
$c_date = date('jS F Y');
$query = "SELECT * FROM users where date='$c_date'";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
$today_users_count = $today_users_count + 1;
}
$query = "SELECT * FROM pastes where s_date='$c_date'";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
$today_pastes_count = $today_pastes_count + 1;
}
for ($loop = 0; $loop <= 6; $loop++) {
$myid = $page_last_id - $loop;
$query = "SELECT * FROM page_view WHERE id='$myid'";
$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
$sdate = $row['date'];
$sdate = str_replace(date('Y'), '', $sdate);
$sdate = str_replace('January', 'Jan', $sdate);
$sdate = str_replace('February', 'Feb', $sdate);
$sdate = str_replace('March', 'Mar', $sdate);
$sdate = str_replace('April', 'Apr', $sdate);
$sdate = str_replace('August', 'Aug', $sdate);
$sdate = str_replace('September', 'Sep', $sdate);
$sdate = str_replace('October', 'Oct', $sdate);
$sdate = str_replace('November', 'Nov', $sdate);
$sdate = str_replace('December', 'Dec', $sdate);
$ldate[$loop] = $sdate;
$tpage[$loop] = $row['tpage'];
$tvisit[$loop] = $row['tvisit'];
}
}
?>
Paste - Dashboard