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