init.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:4k
- <?php
- // +-------------------------------------------------------------+
- // | DeskPRO v [2.0.1 Production]
- // | Copyright (C) 2001 - 2004 Headstart Solutions Limited
- // | Supplied by WTN-WDYL
- // | Nullified by WTN-WDYL
- // | Distribution via WebForum, ForumRU and associated file dumps
- // +-------------------------------------------------------------+
- // | DESKPRO IS NOT FREE SOFTWARE
- // +-------------------------------------------------------------+
- // | License ID : Full Enterprise License =) ...
- // | License Owner : WTN-WDYL Team
- // +-------------------------------------------------------------+
- // | $RCSfile: init.php,v $
- // | $Date: 2004/02/11 20:32:13 $
- // | $Revision: 1.39 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Global initialization.
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- $safe_mode = (bool)ini_get('safe_mode');
- if (!$safe_mode) {
- putenv("TZ=0");
- }
- mktime(0,0,0,1,1,1970);
- require_once(INCLUDE_PATH . 'global.php');
- if (isset($_SERVER['HTTPS'])) {
- $proto = 'https';
- } else {
- $proto = 'http';
- }
- ############################### USEFUL VARIABLES ###############################
- $seed = (double) microtime() * 1000000;
- mt_srand($seed);
- srand($seed);
- $ipaddress = getenv('HTTP_CLIENT_IP') or $ipaddress = getenv('HTTP_X_FORWARDED_FOR') or $ipaddress = getenv('REMOTE_ADDR');
- $ipaddress = trim(preg_replace('#^([^,]+)(,.*)?#', '$1', $ipaddress));
- define('TIMENOW', mktime());
- ############################### INCLUDES ###############################
- if (!@include_once(INCLUDE_PATH . 'config.php')) {
- echo "<b>ERROR:</b> <i>Config.php has not been created</i><br /><br />To start your DeskPRO install or upgrade you must create a config.php file. The README file in the distribution you downloaded shows you how to do this.";
- exit();
- }
- require_once(INCLUDE_PATH . 'license.php');
- require_once(INCLUDE_PATH . 'functions/general_functions.php');
- require_once(INCLUDE_PATH . 'functions/session_functions.php');
- require_once(INCLUDE_PATH . 'functions/fields_functions.php');
- if (constant('DATABASE_TYPE') == 'mysql') {
- require_once(INCLUDE_PATH . 'functions/database/mysql.php');
- $db = new DB_Sql;
- $db->User=constant('DATABASE_USER');
- $db->Password=constant('DATABASE_PASSWORD');
- $db->Host=constant('DATABASE_HOST');
- $db->Database=constant('DATABASE_NAME');
- }
- if (defined('USERZONE')) {
- require_once(INCLUDE_PATH . 'functions/user_functions.php');
- } else {
- require_once(INCLUDE_PATH . 'functions/admin-tech_functions.php');
- require_once(INCLUDE_PATH . 'functions/form_functions.php');
- }
- ############################### SETTINGS ###############################
- get_settings();
- $use_smtp = $settings['use_smtp'];
- $smtp_settings['host'] = $settings['smtp_host'];
- $smtp_settings['port'] = $settings['smtp_port'];
- $smtp_settings['helo'] = $settings['smtp_helo'];
- $smtp_settings['auth'] = $settings['smtp_auth'];
- $smtp_settings['user'] = $settings['smtp_user'];
- $smtp_settings['pass'] = $settings['smtp_pass'];
- ############################### BANNING ###############################
- // check if IP is banned
- if (regex_match($ipaddress, unserialize(get_data('banned_ip')))) {
- mistake($dplang['banned_ip']);
- exit;
- }
- ############################### HTTP / HTTPS ###############################
- if (isset($HTTP_SERVER_VARS['HTTPS'])) {
- $proto = 'https';
- } else {
- $proto = 'http';
- }
- ############################### QUERIES ###############################
- if (defined('DISPLAYQUERIES')) {
- function display_queries() {
- global $query_log;
- echo "<table>" . ($query_log) . "</table>";
- }
- register_shutdown_function('display_queries');
- }