51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
ini_set('memory_limit', '-1'); //不限制内存
|
|
date_default_timezone_set('Asia/Shanghai'); //中国时间
|
|
header("Content-Type: text/html; charset=gbk");//输出编码
|
|
include_once("config.php");
|
|
function config(){
|
|
$WebUrl = $_SERVER['HTTP_HOST'];
|
|
$FileName = $_SERVER['PHP_SELF'];
|
|
$Folders = count(explode('/', $FileName));
|
|
if($Folders > 2){
|
|
for($i=3;$i<=$Folders;$i++){
|
|
$Folder.="../";
|
|
}
|
|
}
|
|
list($WebUrl0,$WebUrl1,$WebUrl2,$WebUrl3)=explode('.', $WebUrl);
|
|
if($WebUrl3){
|
|
$WebUrla=$WebUrl1.".".$WebUrl2.".".$WebUrl3;
|
|
}else{
|
|
if (preg_match('/com|cn|net|org/i',$WebUrl1)){
|
|
$WebUrla=$WebUrl0.".".$WebUrl1;
|
|
}else{
|
|
$WebUrla=$WebUrl1.".".$WebUrl2;
|
|
}
|
|
}
|
|
if(!preg_match('/com|cn|net|org/i',$WebUrl1)) {
|
|
$WebUrlb=$WebUrl1;
|
|
}else{
|
|
$WebUrlb=$WebUrl0;
|
|
}
|
|
if($_SERVER['QUERY_STRING']){
|
|
$Website=$FileName."?".$_SERVER['QUERY_STRING'];
|
|
}else{
|
|
$Website=$FileName;
|
|
}
|
|
return $array=array('Config'=>array(
|
|
'WebUrl'=>$WebUrl,//admin.szhan.com
|
|
'Url'=>$WebUrla,//szhan.com
|
|
'Website'=>$WebUrl.$Website,//admin.szhan.com/admin/adm/topic.php
|
|
'Home'=>"www.".$WebUrla,//www.szhan.com
|
|
'FileName'=>$FileName,// /admin/adm/topic.php
|
|
'Folder'=>$Folder,//../../
|
|
'Template'=>$WebUrlb,//szhan
|
|
'Date'=>date("Y-m-d H:i:s")
|
|
));
|
|
}
|
|
$GG=array_merge(array_change_key_case($_GET,CASE_LOWER),$_POST,config());
|
|
function __autoload($class_name){
|
|
global $GG;
|
|
include($GG['Config']['Folder']."../class/".$class_name.".php");
|
|
}
|
|
?>
|