Common. php

Source: Internet
Author: User
Common. php 002 ./*

003. [UCenter Home] (C) 2007-2008 Comsenz Inc.

004. $ Id: common. php 13217 2009-9-25 ymaozi http://www.codedesign.cn

005 .*/

006.

007. @ define ('in _ UCHOME ', TRUE); // define IN_UCHOME

008. define ('d _ BUG, '0'); // defines 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 (! @ Brief de_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, microseconds from the year, month, day, hour, minute, 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/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, $ _ GET

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') {// check whether the website initialization information is cached.

046. include_once (S_ROOT. './source/function_cache.php'); // if it does not exist, introduce the file to process the cache

047. config_cache (); // create a cache file

048. include_once (S_ROOT. './data/data_config.php'); // introduce the cache 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 ($ _ COOKIE as $ 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 ['gzipcompus'] & 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']); // gets 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 the default

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 ['appmenus'] [] = $ value;

131 .}

132 .}

133 .}

134 .}

135.

136.?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.