<?php
// +---------------------------------------------------------------------------+
// | LogView 1.0 for Geeklog - The Ultimate Weblog |
// +---------------------------------------------------------------------------+
// | logview.php |
// | |
// | This Geeklog log file viewer. Drop it into your admin directory -- |
// | edit the lib-common.php line and path line -- Your ready. |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2003 by the following authors: |
// | |
// | Authors: Tom Willett - twillett@users.sourceforge.net |
// +---------------------------------------------------------------------------+
// | |
// | 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 2 |
// | 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 for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
//
//
// you will need to edit the path to lib-common.php if you put this file anywhere other than
// the Ban Plugin admin directory in a standard install
//
require_once('../lib-common.php');
// Path to this file
$path = $_CONF['site_admin_url'] . '/';
// Only let Root users access this page
if (!SEC_inGroup('Root')) {
// Someone is trying to illegally access this page
COM_errorLog("Someone has tried to illegally access the LogView page. User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: $REMOTE_ADDR",1);
$display = COM_siteHeader()
. COM_startBlock("Access Denied!!!")
. "You are illegally trying to access the File LogView page. This attempt has been logged"
. COM_endBlock()
. COM_siteFooter(true);
echo $display;
exit;
}
/*
* Main Function
*/
$action = $_REQUEST['action'];
$log = $_REQUEST['pdf'];
$fpath = 'E:/WebSites/spacequad141/public_html/Google-Analytics/';
$display = COM_siteHeader()
. COM_startBlock("Geeklog Google Analytics File Viewer")
. "<p>Views/Clear the Geeklog Google Analytics Files.<p>"
. "<form method=\"post\" action=\"{$path}/google_stats.php\">"
. "File: ";
$files = array();
if ($dir = @opendir($fpath)) {
while(($file = readdir($dir)) !== false) {
if (is_file($fpath . $file)) { array_push($files,$file); }
}
closedir($dir);
}
$display .= '<select name="pdf">';
if (empty($log)) { $log = $files[0]; } // default file to show
for ($i = 0; $i < count($files); $i++) {
$display .= '<option value="' . $files[$i] . '"';
if ($log == $files[$i]) {
$display .= ' selected';
}
$display .= '>' . $files[$i] . '</option>';
next($files);
}
$display .= "</select> "
. "<input type=\"submit\" name=\"action\" value=\"View Google Analytics File\">"
. " "
. "<input type=\"submit\" name=\"action\" value=\"Clear Google Analytics File\">"
. "</form>";
if ($action == 'Clear Google Analytics File') {
unlink($fpath . $log);
$timestamp = strftime( "%c" );
$fd = fopen( $fpath . $log, a );
fputs( $fd, "$timestamp - Google Analytics File Cleared \n" );
fclose($fd);
$action = 'View Google Analytics File';
}
if ($action == 'View Google Analytics File') {
$display .= "<hr><p><b>Stats File: $log</b></p><pre>"
. implode('', file($fpath . $log))
. "</pre>";
}
$display .= COM_endBlock() . COM_siteFooter(false);
echo $display;
?>