001. <? Php
003.[UCenter Home] (C) 2007-2008 Comsenz Inc.
004.$ Id: common. php 13217 ymaozi
005 .*/
006.
007. @ define ('in _ UCHOME ', TRUE );// Define IN_UCHOME
008. define ('d _ BUG ', '0 ');// Define the error level
009.
010. D_BUG? Error_reporting (7): error_reporting (0 );
011. set_magic_quotes_runtime (0 );// Disable the automatic escape Function
012.
013. $ _ SGLOBAL =$ _ SCONFIG =$ _ SBLOCK =$ _ TPL =$ _ SCOOKIE =$ _ SN = $ space =Array();
014.
015. // program directory
016. define ('s _ ROOT ', dirname (_ FILE _). DIRECTORY_SEPARATOR );// Define the root directory of the program
017.
018. // basic file
019.Include_once(S_ROOT. './ver. php ');// Import some uchome version information
020.If(! @Include_once(S_ROOT. './config. php ')){// Determine whether the website configuration file exists. If it does not exist, install the website
021.Header ("Location: install/index. php"); // install
022.Exit ();
023 .}
024.Include_once(S_ROOT. './source/function_common.php ');// Introduce the public function File
025.
026. // time
027. $ mtime = explode ('', microtime ());// Separate the current time, in microseconds from the year, month, day, hour, and second
028. $ _ SGLOBAL ['timestamp'] = $ mtime [1]; // obtain the current year/month/day hour/minute/banknote
029. $ _ SGLOBAL ['supe _ starttime'] = $ _ SGLOBAL ['timestamp'] + $ mtime [0];// Year/month/day hour/minute/Bill + microsecond
030.
031. // GPC Filtering
032. $ magic_quote = get_magic_quotes_gpc ();// Whether the automatic escape function is enabled
033.If(Empty ($ magic_quote )){// Manually escape the submitted $ _ POST and $ _ GET if it is not enabled
034.$ _ GET = saddslashes ($ _ GET );
035.$ _ POST = saddslashes ($ _ POST );
036 .}
037.
038. // This site URL
039.If(Empty ($ _ SC ['siteurl']) $ _ SC ['siteurl'] = getsiteurl ();
040.
041. // link to the database
042. dbconnect ();
043.
044. // cache file
045.If(! @Include_once(S_ROOT. './data/data_config.php') {// indicates whether the website initialization information is cached.
046.Include_once(S_ROOT. './source/function_cache.php'); // if the file does not exist, the cached file is introduced.
047.Config_cache ();// Create a cache file
048.Include_once(S_ROOT. './data/data_config.php ');// Introduce the cached File
049 .}
050.Foreach(Array('App', 'userapp', 'ad', 'Magic ')As$ Value ){
051.@Include_once(S_ROOT. './data _'. $ value. '. php ');// Import the app, userapp, ad, and magic configuration files.
052 .}
053.
054. // COOKIE
055. $ prelength = strlen ($ _ SC ['cookiepre']);// Obtain the COOKIE prefix length
056.Foreach($ _ COOKIEAs$ Key => $ val ){
057.If(Substr ($ key, 0, $ prelength) == _ SC ['cookiepre']) {
058.$ _ SCOOKIE [(substr ($ key, $ prelength)] = empty ($ magic_quote )? Saddslashes ($ val): $ val;
059.}
060 .}
061.
062. // enable GIP
063.If($ _ SC ['gzipcompress'] & amp; function_exists ('ob _ gzhandler ')){
064.Ob_start ('ob _ gzhandler ');
065 .}Else{
066.Ob_start ();
067 .}
068.
069. // Initialization
070. $ _ sglobal ['supe _ uid'] = 0;
071. $ _ sglobal ['supe _ username'] = '';// Set UID and username to null.
072. $ _ sglobal ['ajax '] = empty ($ _ Get ['ajax'])? 0: intval ($ _ Get ['ajax ']);// Whether Ajax is used
073. $ _ sglobal ['mobile'] = empty ($ _ Get ['mobile'])? '': Trim ($ _ Get ['mobile']);// Get the mobile phone number submitted by $ _ Get
074. $ _ sglobal ['ajaxmenuid'] = empty ($ _ Get ['ajaxmenuid'])? '': $ _ Get ['ajaxmenuid'];
075. $ _ sglobal ['Referer'] = empty ($ _ server ['HTTP _ referer'])? '': $ _ Server ['HTTP _ referer'];// Obtain the URL of the previous page
076.If(Empty ($ _ Get ['m _ timestamp']) | $ _ sglobal ['mobile']! = MD5 ($ _ Get ['m _ timestamp']. "\ t ". $ _ sconfig ['sitekey']) $ _ sglobal ['mobile'] = '';
077.
078. // log on to the registration anti-Water Filling Machine
079.If(Empty ($ _ SCONFIG ['login _ action']) $ _ SCONFIG ['login _ action'] = md5 ('login '. md5 ($ _ SCONFIG ['sitekey']);
080.If(Empty ($ _ SCONFIG ['register _ action']) $ _ SCONFIG ['register _ action'] = md5 ('register '. md5 ($ _ SCONFIG ['sitekey']);
081.
082. // the whole site Style
083.If(Empty ($ _ SCONFIG ['template']) {// use
084.$ _ SCONFIG ['template'] = 'default ';
085 .}
086.If($ _ SCOOKIE ['mytemplate']) {
087.$ _ SCOOKIE ['mytemplate'] = str_replace ('.', '', trim ($ _ SCOOKIE ['mytemplate']);
088.If(File_exists (S_ROOT. './template/'. $ _ SCOOKIE ['mytemplate']. '/style.css ')){
089.$ _ SCONFIG ['template'] = $ _ SCOOKIE ['mytemplate'];
090.}Else{
091.Ssetcookie ('mytemplate', '', 365000 );
092.}
093 .}
094.
095. // url: http://u.codedesign.cn/space.php? Do = home
096. // $ _ SERVER ['request _ URI ']: space. php? Do = home
097. // $ _ SERVER ['php _ SELF ']: space. PHP
098. // $ _ SERVER ['query _ string']:Do = home
099. // process REQUEST_URI
100.If(! Isset ($ _ SERVER ['request _ URI ']) {
101.$ _ SERVER ['request _ URI '] = $ _ SERVER ['php _ SELF'];
102.If(Isset ($ _ SERVER ['query _ string']) $ _ SERVER ['request _ URI ']. = '? '. $ _ SERVER ['query _ string'];
103 .}
104.If($ _ SERVER ['request _ URI ']) {
105.$ Temp = urldecode ($ _ SERVER ['request _ URI ']);
106.If(Strexists ($ temp, '<') | strexists ($ temp ,'"')){
107.$ _ GET = shtmlspecialchars ($ _ GET); // XSS
108.}
109 .}
110.
111. // determine the user logon status
112. checkauth (); // determine whether to log on
113. $ _ SGLOBAL ['uhash'] = md5 ($ _ SGLOBAL ['supe _ uid']. "\ t ". substr ($ _ SGLOBAL ['timestamp'], 0, 6); // encrypt the user's uid with the first six digits of the current time using md5
114.
115. // user menu
116. getuserapp ();
117.
118. // process UC applications
119. $ _ SCONFIG ['uc _ status'] = 0;
120. $ _ SGLOBAL ['append'] = $ _ SGLOBAL ['append'] =Array();
121.If($ _ SGLOBAL ['app']) {
122.Foreach($ _ SGLOBAL ['app']As$ Appid => $ value ){
123.If(UC_APPID! = $ Appid ){
124.$ _ SCONFIG ['uc _ status'] = 1;
125.}
126.If($ Value ['open']) {
127.If(Empty ($ _ SGLOBAL ['append']) {
128.$ _ SGLOBAL ['append'] = $ value;
129.}Else{
130.$ _ SGLOBAL ['append'] [] = $ value;
131.}
132.}
133.}
134 .}
135.
136.?>