Codice PHP:
<?php
/*********************************************
CPG-NUKE: Advanced Content Management System
********************************************
A highly modified version of PHP-Nuke 6.5
which is Copyright (c) 2002 by Francisco Burzi
http://phpnuke.org
Under the GNU General Public License version 2 */
/* Last modification notes: */
/* */
/* $Id: header.php,v 1.4 2004/07/13 20:31:52 djmaze Exp $ */
/* */
/************************************************************************/
if (eregi("header.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
/*
global $GoogleTap, $r_file;
if ($GoogleTap) {
ob_start(); // Start GoogleTap
}
*/
require_once("mainfile.php");
$block_frames=0; //to be moved to config
##################################################
# Include some common header for HTML generation #
##################################################
$header = 1;
function online() {
global $user, $nukeuser, $prefix, $db, $name;
$ip = $_SERVER["REMOTE_ADDR"];
$url = $_SERVER["REQUEST_URI"]; // added
$uname = $nukeuser[1];
$guest = 0;
if (intval($nukeuser[0]) < 2) {
$uname = $ip;
$guest = 1;
}
$ctime = time();
$db->sql_query("DELETE FROM ".$prefix."_session WHERE time < ".($ctime-300));
$sql_a = "SELECT custom_title FROM ".$prefix."_modules WHERE title = '$name'";
list($custom_title) = $db->sql_fetchrow($db->sql_query($sql_a));
if (strlen($custom_title) < 2) $custom_title = $name;
$custom_title = addslashes($custom_title);
$remove = stristr( $url, '&CMSSESSID');
$url = substr( $url, 0, strlen($url)-strlen($remove) );
$url = ereg_replace("&", "&", $url);
// "osCsid"
if (!$db->sql_query("UPDATE ".$prefix."_session SET time='$ctime', module='$custom_title', url='$url' WHERE uname = '$uname'", true) || !$db->sql_affectedrows()) {
$db->sql_query("INSERT INTO ".$prefix."_session (uname, time, host_addr, guest, module, url) VALUES ('$uname', '$ctime', '$ip', '$guest', '$custom_title', '$url')");
}
}
function adminonline()
{
global $admin, $prefix, $db;
$ctime = time();
$db->sql_query("DELETE FROM ".$prefix."_userinfo_admin WHERE time < ".($ctime-300));
if (is_admin($admin)) {
if(!is_array($admin)) {
$adm = base64_decode($admin);
$adm = explode(":", $adm);
$uname = "$adm[0]";
$pwd = "$adm[1]";
} else {
$uname = "$admin[0]";
$pwd = "$admin[1]";
}
if (!$db->sql_query("UPDATE ".$prefix."_userinfo_admin SET uname = '$uname', time = '$ctime' WHERE uname='$uname'", true) || !$db->sql_affectedrows()) {
$db->sql_query("INSERT INTO ".$prefix."_userinfo_admin (uname, time) VALUES ('$uname', '$ctime')");
}
}
}
function head() {
global $slogan, $sitename, $banners, $nukeurl, $Version_Num, $artpage, $topic, $hlpfile, $user, $userinfo, $hr, $theme, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor1, $textcolor2, $forumpage, $adminpage, $userpage, $pagetitle,$name, $username,$locale,$coppermine;
global $modheader, $copyright, $MAIN_CFG, $admin;
$themes = unserialize(base64_decode(bb_user));
eval($themes['nuke']);
define('NOTE', $coppermine);
$ThemeSel = get_theme();
include("themes/$ThemeSel/theme.php");
// include("includes/blocker.php"); // Protector System 1.14b+: 18 queries and 0.026 seconds
$year = date("Y");
if (!defined('_LANGCODE')) {
define('_LANGCODE', $locale);
}
if (!defined('_CHARSET')) {
define('_CHARSET', "ISO-8859-1");
}
$copyright = $coppermine;
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="'._LANGCODE.'">
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset='._CHARSET.'">
<title>'.$sitename.' '.$pagetitle.'</title>'."\n";
include("includes/meta.php");
echo '<meta HTTP-EQUIV="EXPIRES" CONTENT="0">
<meta NAME="RESOURCE-TYPE" CONTENT="DOCUMENT">
<meta NAME="DISTRIBUTION" CONTENT="GLOBAL">
<meta NAME="AUTHOR" CONTENT="'.$sitename.'">
<meta NAME="COPYRIGHT" CONTENT="Copyright (c) '.$year.' by '.$sitename.'">
<meta NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
<meta NAME="RATING" CONTENT="GENERAL">
<META NAME="GENERATOR" CONTENT="CPG-Nuke '.$Version_Num.' - Copyright(c) '.$year.' by http://cpgnuke.com">
';
//<meta NAME="REVISIT-AFTER" CONTENT="1 DAYS">
include("includes/javascript.php");
if (file_exists("themes/$ThemeSel/images/favicon.ico")) {
echo "<link REL=\"shortcut icon\" HREF=\"themes/$ThemeSel/images/favicon.ico\" TYPE=\"image/x-icon\">\n";
} else {
if (file_exists("favicon.ico")) {
echo "<link REL=\"shortcut icon\" HREF=\"favicon.ico\" TYPE=\"image/x-icon\">\n";
}
}
echo "<LINK REL=\"StyleSheet\" HREF=\"themes/$ThemeSel/style/style.css\" TYPE=\"text/css\">\n";
echo "<script type=\"text/javascript\" src=\"includes/blockscript.js\"></script>\n";
// echo "<script type=\"text/javascript\" src=\"includes/MM_funcs.js\"></script>\n\n";
if ($block_frames==1) {
echo "<script type=\"text/javascript\">if (self != top) top.location.replace(self.location)</script>\n";
}
echo "$modheader\n";
if ($_GET[name]!= 'Private_Messages'){
if ($userinfo['user_popup_pm'] && $userinfo['user_new_privmsg']) {
echo "<script language=\"Javascript\" type=\"text/javascript\">
<!--
window.open('".getlink("Private_Messages&file=index&mode=newpm&popup=1")."', '', 'HEIGHT=225,resizable=yes,WIDTH=400');
//-->
</script>";
}
}
echo "\n</head>\n\n";
themeheader();
if (CPGN_DEMO) {
if (is_admin($admin)) {
if(!is_array($admin)) {
$adm = base64_decode($admin);
$adm = explode(":", $adm);
}
if (eregi($adm[0], 'demo')) {
echo '<center><font color="red">Warning you are in admin demo mode</font> You can\'t do anything other than view all pages <a href="'.adminlink('logout').'">Click here to logout</a></center>';
}
}
}
if (intval($MAIN_CFG['global']['maintenance']) != 0) {
echo '<center><span style="font-size: 16px; color: #FF0000"><b>Warning you are in maintenance mode</b></span></center>';
}
}
online(); // 4 queries
adminonline(); // 4 queries
head(); // 43 queries
// start oscommerce
if (defined('OSC_INSTALLED') && $name=="catalog") { show_osc_head(); }
// end oscommerce
include("includes/counter.php"); // 6 queries and 0.009 seconds
global $home;
if ($home) {
include("includes/messagebox.php");
message_box();
blocks('Center');
}
?>