2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 11/15/2003 *
\r
4 * =============== Last change: 04/02/2004 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : what-usage.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : Auto-detection of usage statistics *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : Automatische Erkennung der Aufrufstatistiken *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2007 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // Some security stuff...
\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
\r
40 // Add description as navigation point
\r
41 ADD_DESCR("admin", basename(__FILE__));
\r
43 OPEN_TABLE("100%", "admin_content admin_content_align", "");
\r
45 if (!empty($_GET['image']))
\r
47 if ($_GET['type'] == "usage")
\r
49 $file = PATH.$usage."usage.png";
\r
53 if (strpos($_GET['image'], "\\") > 0) $_GET['image'] = substr($_GET['image'], 0, strpos($_GET['image'], "\\"));
\r
54 $file = PATH.$usage.$_GET['type']."_usage_".$_GET['image'].".png";
\r
56 if (file_exists($file))
\r
58 $image = imagecreatefrompng($file);
\r
59 header("Content-type: image/png");
\r
61 imagedestroy($image);
\r
65 elseif (empty($_GET['usage']))
\r
67 $file = PATH.$usage."index.html";
\r
71 $file = sprintf("%s%susage_%s.html",
\r
74 SQL_ESCAPE($_GET['usage'])
\r
79 if (file_exists($file) && is_readable($file))
\r
81 $tmpl_file = implode("", file($file));
\r
82 $tmpl_file = addslashes($tmpl_file);
\r
83 $tmpl_file = "\$content=\"".$tmpl_file."\";";
\r
85 $content = str_replace("usage.png", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&type=usage&image=usage", $content);
\r
86 $content = str_replace("daily_usage_", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&type=daily&image=", $content);
\r
87 $content = str_replace("hourly_usage_", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&type=hourly&image=", $content);
\r
88 $content = str_replace("ctry_usage_", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&type=ctry&image=", $content);
\r
89 $content = str_replace("usage_", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&usage=", str_replace(".html", "", $content));
\r
90 // Disabled due to too much trouble
\r
91 //$content = str_replace("HREF=\"http://", "href=\"".URL."/modules.php?module=loader&url=http://", $content);
\r
92 $test = strtolower($content);
\r
93 $body_start = strpos($test, "<body");
\r
94 $body_end = strpos($test, "</body>");
\r
95 if (($body_start > 0) && ($body_end > 0))
\r
97 $content = substr(substr($content, 0, $body_end), $body_start);
\r
98 $content = substr($content, strpos($content, ">") + 1);
\r
99 OUTPUT_HTML ("<DIV align=\"left\">
\r