?? global.php
字號:
<?php
error_reporting(7);
if (isset($HTTP_GET_VARS['explain']) OR isset($HTTP_POST_VARS['explain'])) {
$showqueries = 1;
$explain = 1;
}
if (isset($HTTP_GET_VARS['showqueries']) OR isset($HTTP_POST_VARS['showqueries']) OR isset($showqueries)) {
$showqueries = 1;
$pagestarttime = microtime();
} else {
$pagestarttime = 0;
}
// allow script to work with registerglobals off
if ( function_exists('ini_get') ) {
$onoff = ini_get('register_globals');
} else {
$onoff = get_cfg_var('register_globals');
}
if ($onoff != 1) {
@extract($HTTP_SERVER_VARS, EXTR_SKIP);
@extract($HTTP_COOKIE_VARS, EXTR_SKIP);
@extract($HTTP_POST_FILES, EXTR_SKIP);
@extract($HTTP_POST_VARS, EXTR_SKIP);
@extract($HTTP_GET_VARS, EXTR_SKIP);
@extract($HTTP_ENV_VARS, EXTR_SKIP);
}
// get rid of slashes in get / post / cookie data
function stripslashesarray (&$arr) {
while (list($key,$val)=each($arr)) {
if ($key!="templatesused" and $key!="argc" and $key!="argv") {
if (is_string($val) AND (strtoupper($key)!=$key OR ("".intval($key)=="$key"))) {
$arr["$key"] = stripslashes($val);
} else if (is_array($val) AND ($key == 'HTTP_POST_VARS' OR $key == 'HTTP_GET_VARS' OR strtoupper($key)!=$key)) {
$arr["$key"] = stripslashesarray($val);
}
}
}
return $arr;
}
if (get_magic_quotes_gpc() and is_array($GLOBALS)) {
if (isset($attachment)) {
$GLOBALS['attachment'] = addslashes($GLOBALS['attachment']);
}
$GLOBALS = stripslashesarray($GLOBALS);
}
set_magic_quotes_runtime(0);
@error_reporting(7);
$incp = 0;
// initialise variables
unset($emailReplaceArray);
unset($emailSearchArray);
unset($iaccesscache);
unset($iforumcache);
unset($ipermcache);
unset($noperms);
unset($permscache);
unset($postcache);
unset($threadcache);
unset($urlReplaceArray);
unset($urlSearchArray);
unset($usercache);
unset($usergroupcache);
unset($usergroupdef);
unset($vars);
// get useful vars
$ipaddress=$REMOTE_ADDR;
$scriptpath=$REQUEST_URI;
if ($scriptpath=='') {
if ($PATH_INFO) {
$scriptpath = $PATH_INFO;
} else {
$scriptpath = $PHP_SELF;
}
if ($QUERY_STRING) {
$scriptpath .= '?'.addslashes($QUERY_STRING);
}
}
if ( !isset($url) ) {
$url=$HTTP_SERVER_VARS['HTTP_REFERER'];
} else {
if ($url==$HTTP_SERVER_VARS['HTTP_REFERER']) {
$url='index.php';
}
}
if ($url==$scriptpath or $url=='') {
$url='index.php';
}
$url = str_replace('$','',addslashes($url));
if ($HTTP_GET_VARS['HTTP_POST_VARS']['action'] == $HTTP_POST_VARS['action']) {
unset($HTTP_POST_VARS['action']);
}
$HTTP_POST_VARS['action'] = trim($HTTP_POST_VARS['action']);
// ###################### Start init #######################
unset($dbservertype);
unset($debug);
//load config
require('./admin/config.php');
/*
if ($debug != 1) {
unset($showqueries);
unset($explain);
} else {
$showqueries = 1;
$explain = 1;
}
*/
// init db **********************
// load db class
$dbservertype = strtolower($dbservertype);
$dbclassname="./admin/db_$dbservertype.php";
require($dbclassname);
$DB_site=new DB_Sql_vb;
$DB_site->appname='[足跡]音樂系統';
$DB_site->appshortname='[足跡]音樂';
$DB_site->database=$dbname;
$DB_site->server=$servername;
$DB_site->user=$dbusername;
$DB_site->password=$dbpassword;
$DB_site->connect();
$dbpassword="";
$DB_site->password="";
// end init db
if ( isset($showqueries) ) {
echo "<pre>";
}
// ###################### Start functions #######################
require('./admin/functions.php');
// ###################### Start load options #######################
$optionstemp=$DB_site->query_first("SELECT template FROM ".$table["template"]." WHERE title='options'");
eval($optionstemp['template']);
// ###################### Start headers #######################
if ($addheaders and !$noheader) {
// default headers
@header("HTTP/1.0 200 OK");
@header("HTTP/1.1 200 OK");
@header("Content-type: text/html");
}
if ($nocacheheaders and !$noheader) {
// no caching
@header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
@header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT"); // always modified
@header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@header("Pragma: no-cache"); // HTTP/1.0
}
// ###################### Start sessions #######################
require('./admin/sessions.php');
// ###################### Start templates #######################
//prepare default templates **********************
if ($templatesused!='') {
$templatesused.=',';
}
$templatesused.='phpinclude,headinclude,header,footer,header_search,playerlink,searchlink,logedin,logedout';
$templatesused.=',topmusic,topmusic_lists,topmusic_nolist,topalbum,topalbum_lists,topalbum_nolist';
unset($templatecache);
cachetemplates($templatesused);
$header='';
$footer='';
// parse PHP include ##################
eval(gettemplate('phpinclude',0,0));
// parse css, header & footer ##################
eval("\$headinclude = \"".gettemplate('headinclude')."\";");
eval("\$header_search = \"".gettemplate('header_search')."\";");
eval("\$header .= \"".gettemplate('header')."\";");
eval("\$searchlink = \"".gettemplate('searchlink')."\";");
eval("\$playerlink = \"".gettemplate('playerlink')."\";");
eval("\$footer .= \"".gettemplate('footer')."\";");
// 判斷用戶是否登陸,顯示不同的歡迎信息
if ($bbuserinfo['userid']!=0) {
$temp = $username;
$username=$bbuserinfo['username'];
eval("\$logininfo = \"".gettemplate('logedin')."\";");
$username = $temp;
unset($temp);
} else {
eval("\$logininfo = \"".gettemplate('logedout')."\";");
}
// ###################### 歌曲排行 ###################################
$tempname = $musicname;
$tempsinger = $singer;
$musics = $DB_site->query("SELECT ID,MusicName,Hits,Singer
FROM ".$table["musiclist"]."
ORDER BY Hits DESC
LIMIT ".intval($maxNumTopMusic));
if ($music=$DB_site->fetch_array($musics)) {
$musicid = $music['ID'];
$musicname = $music['MusicName'];
$shortmusicname = getfirststr($music['MusicName'], 16, "..");
$hits = $music['Hits'];
$singer = $music['Singer'];
eval("\$topmusics = \"".gettemplate('topmusic_lists')."\";");
while ($music=$DB_site->fetch_array($musics)) {
$musicid = $music['ID'];
$musicname = $music['MusicName'];
$shortmusicname = getfirststr($music['MusicName'], 16, "..");
$hits = $music['Hits'];
$singer = $music['Singer'];
eval("\$topmusics .= \"".gettemplate('topmusic_lists')."\";");
}
} else {
eval("\$topmusics = \"".gettemplate('topmusic_nolist')."\";");
}
$DB_site->free_result($musics);
eval("\$topmusic = \"".gettemplate('topmusic')."\";");
$musicname = $tempname;
$singer = $tempsinger;
unset($tempname);
unset($tempsinger);
// ###################### 熱點專輯 ####################################
$tempsinger = $singer;
$albums = $DB_site->query("SELECT SpecialID,Name,Hits,NClassName
FROM ".$table["special"]."
ORDER BY Hits DESC
LIMIT ".intval($maxNumTopAlbum));
if ($album=$DB_site->fetch_array($albums)) {
$albumid = $album['SpecialID'];
$name = $album['Name'];
$shortname = getfirststr($album['Name'], 16, "..");
$hits = $album['Hits'];
$singer = $album['NClassName'];
eval("\$topalbums = \"".gettemplate('topalbum_lists')."\";");
while ($album=$DB_site->fetch_array($albums)) {
$albumid = $album['SpecialID'];
$name = $album['Name'];
$shortname = getfirststr($album['Name'], 16, "..");
$hits = $album['Hits'];
$singer = $album['NClassName'];
eval("\$topalbums .= \"".gettemplate('topalbum_lists')."\";");
}
} else {
eval("\$topalbums = \"".gettemplate('topalbum_nolist')."\";");
}
$DB_site->free_result($albums);
eval("\$topalbum = \"".gettemplate('topalbum')."\";");
$singer = $tempsinger;
unset($tempsinger);
// end prepare default templates ********************
$permissions=getpermissions();
// check that board is active - if not admin, then display error
if (!$bbactive) {
if (!$permissions['cancontrolpanel']) {
eval("standarderror(\"".str_replace("\'", "'", addslashes($bbclosedreason))."\");");
exit;
}
}
if ($HTTP_SERVER_VARS['SCRIPT_NAME'] and substr( $HTTP_SERVER_VARS['SCRIPT_NAME'] , -strlen('.php') ) == '.php' ) {
$currentscript = strtolower($HTTP_SERVER_VARS['SCRIPT_NAME']);
} else {
$currentscript = strtolower($HTTP_SERVER_VARS['PHP_SELF']);
}
$logincode=makelogincode();
?>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -