⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.php

📁 1.增加了近40项后台核心设置
💻 PHP
字号:
<?php
define('R_P','./');
define('XYDW','OK');
$REQUEST_URI=$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
if($_SERVER['HTTP_X_FORWARDED_FOR']){
     $onlineip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}elseif($_SERVER['HTTP_CLIENT_IP']){
     $onlineip=$_SERVER['HTTP_CLIENT_IP'];
}else{
     $onlineip=$_SERVER['REMOTE_ADDR'];
}
if(!get_magic_quotes_gpc()){
	Add_S($_POST);
	Add_S($_GET);
	Add_S($_COOKIE);
}
if(!ini_get('register_globals')){
	@extract($_COOKIE,EXTR_SKIP);
	@extract($_FILES,EXTR_SKIP);
}
unset($_POST['isadmining'],$_GET['isadmining']);
foreach($_POST as $_key=>$_value){
	$_POST[$_key]=str_replace('$','&ensp;$',$_POST[$_key]);
	!ereg("^\_",$_key) && $$_key=$_POST[$_key];
}
foreach($_GET as $_key=>$_value){
	$_GET[$_key]=str_replace('$','&ensp;$',$_GET[$_key]);
	!ereg("^\_",$_key) && $$_key=$_GET[$_key];
}
$timestamp = time();
$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
if(file_exists(R_P."data/cache/root.php")){
   include_once R_P."data/cache/root.php";
}
require R_P."config.php";
require R_P."include/db.php";
$db = new db();
$dbconnect = $db->dbconnect($rootindex['pconnect']);
if(!$rootindex){
   $rootindex = $db->getone("SELECT * FROM xydw_root");
   //@extract($rootindex,EXTR_SKIP);
   //$siteemail = $email;
}
$ishtml = $rootindex['ishtml'];


//刷新与维护

if(!$rootindex['close'] && !$isadmining){
   msg($rootindex['closetxt'],'#','10000000');
}
if(!$isadmining){
   session_start();
   $actiontime = $_SESSION['X_T'];
   session_register('X_T');
   $_SESSION['X_T'] = $timestamp;
}
if(!$isadmining && $rootindex['timelimit'] && $timestamp-$actiontime<$rootindex['timelimit']) msg('timelimit','index.php','100');
if(file_exists(R_P."data/styles/".$rootindex['dstyle'].".php")){
   @include_once R_P."data/styles/".$rootindex['dstyle'].".php";
} else {
   $styleindex = $db->getone("SELECT * FROM xydw_styles");
   @extract($styleindex,EXTR_SKIP);
}
$rootindex['obstart'] == "1" ? ob_start('ob_gzhandler') : ob_start();
$version="1.12";
function readover($filename,$method="rb"){
	if($handle=@fopen($filename,$method)){
		flock($handle,LOCK_SH);
		$filedata=@fread($handle,filesize($filename));
		fclose($handle);
	}
	return $filedata;
}
function writeover($filename,$data,$method="rb+",$iflock=1){
	touch($filename);
	$handle=fopen($filename,$method);
	if($iflock){
		flock($handle,LOCK_EX);
	}
	fputs($handle,$data);
	if($method=="rb+") ftruncate($handle,strlen($data));
	fclose($handle);
}
function Add_S(&$array){
	foreach($array as $key=>$value){
		if(!is_array($value)){
			$array[$key]=addslashes($value);
		}else{
			Add_S($array[$key]);
		}
	}
}
function xsubstr($content,$length,$point='0') {
	if($length && strlen($content)>$length){
		$num=0;
		for($i=0;$i<$length;$i++) {
			if(ord($content[$i])>127){
				$num++;
			}
		}
		$num%2 ? $content=substr($content,0,$length-1):$content=substr($content,0,$length);
		$point ? "" : $content.='..';
	}
	return $content;
}

function listpage($table,$lid,$size,$other=''){
   global $page,$db;
   !$lid ? $whe = "" : $whe = " WHERE lid=$lid";
   $other ? $whe = $other : "";
   isset($page) ? $page = intval($page) : $page = 1;
   $row = $db->getone("SELECT count(*) as amount FROM $table$whe");
   $amount = $row[amount];
   if($amount){
       $amount < $size ? $page_count = 1 : "";
       $amount % $size ? $page_count = (int)($amount / $size) + 1 : $page_count = $amount / $size;
   } else $page_count = 0;
   for($i=1;$i<$page_count+1;$i++){
       $i == $page ? $select = " selected" : $select = "";
       $opt .= "<option value={$i}$select>第{$i}页</option>";
   }
   $ret = "共{$page_count}页 <select onchange=Pagejump(this.options[this.selectedIndex].value)>{$opt}</select>";
   return $ret;
}
function lang($lang){
   return R_P."temp/lang/lang_".$lang.".php";
}
function temp($temp){
   global $htmlpath;
   return file_exists(R_P."temp/".$htmlpath."/".$temp.".htm") ? R_P."temp/".$htmlpath."/".$temp.".htm" : R_P."temp/xydw/".$temp.".htm";
}
function msg($value='default',$to='',$time='3'){
   global $tablecolor,$bcolor,$rootindex;
   ob_end_clean();
   $rootindex['obstart'] == "1" ? ob_start('ob_gzhandler') : ob_start();
   include_once lang('premsg');
   $value or $value = 'default';
   $value == '8' ? $value = 'default_w' : '';
   if(@in_array($value,array_keys($lang))) $value = $lang[$value];
   $refer = $_SERVER['HTTP_REFERER'];
   $to ? '' : $to = $refer;
   include temp('msgto');
   exit;
}
function makeradio($radios){
   foreach($radios[option] as $radiok => $radio){
        $ret .= " <input type=radio name=$radios[name] value='$radiok'";
        $radiok == "$radios[select]" && $ret .= " checked";
        $ret .= "> $radio ";
   }
   return $ret;
}
function makecheck($check){
   $ret .= " <input type=checkbox name=$check[name] value=$check[value]";
   $check['select'] && $ret .= " checked";
   $ret .= ">";
   return $ret;
}
function Nohtml(&$msg,$br='0'){
	$msg = str_replace('&amp;','&',$msg);
	$msg = str_replace('&nbsp;',' ',$msg);
	$msg = str_replace('"','&quot;',$msg);
	$msg = str_replace("'",'&#39;',$msg);
	$msg = str_replace("<","&lt;",$msg);
	$msg = str_replace(">","&gt;",$msg);
	$msg = str_replace("\t","   &nbsp;  &nbsp;",$msg);
	$msg = str_replace("\r","",$msg);
	$msg = str_replace("   "," &nbsp; ",$msg);
    $br ? "" : $msg = nl2br($msg);
}
function ReplaceWord(&$s){
    $void_f = readover(R_P."data/void_words.php");
    if($void_f){
       $void_db = explode("\n","$void_f");
       foreach($void_db as $void_wdb){
           $void_w = explode("=","$void_wdb");
           $s = str_replace("$void_w[0]","$void_w[1]",$s);
       }
   }
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -