init.php
上传用户:jiangbw
上传日期:2022-03-16
资源大小:49k
文件大小:16k
- <?
- /*======================================================================*
- || #################################################################### ||
- || # BUILD UNDER PHP SCRIPTNET 3.2.1 FRAMEWORK ||
- || # ---------------------------------------------------------------- # ||
- || # Code2Art Open Source Software. All Rights Reserved. ||
- || # This file should be redistributed in whole or significant part. # ||
- || # ------------------ SCRIPTNET IS FREE SOFTWARE ------------------ # ||
- || # http://www.code2art.com | http://www.code2art.com/scriptnet # ||
- || # Copyleft by Benediktus Ardian Hersanto, SE # ||
- || # Sorry if this framework is still unavailable for public # ||
- || # because I still searching on my own head. # ||
- || #################################################################### ||
- *======================================================================*/
- /*======================================================================*
- || #################################################################### ||
- || DBF to MySQL Bulk Converter 2.0 ||
- ||______________________________________________________________________||
- || This utility was developed on 2006, since this were used to be on ||
- || my own library. But I think I should share it to you, because I ||
- || need to save my work on Internet (I don't believe on my own HD drive)||
- || it always crash and had a terrible bad sectors. ||
- || Thanks to all person who download this utility, I hope you enjoy it. ||
- || ||
- || Regards, ||
- || Benediktus Ardian Hersanto,SE (ardie_b@yahoo.com) ||
- /*======================================================================*/
- // ---------------------------------------------------------------------//
- // Free to use for everyone who understand PHP
- // ---------------------------------------------------------------------//
- $time_begin = microtime();
- if(!isset($_SERVER)) $_SERVER = $HTTP_SERVER_VARS;
- if(!isset($_GET)) $_GET = $HTTP_GET_VARS;
- if(!isset($_POST)) $_POST = $HTTP_POST_VARS;
- if(!isset($_REQUEST)) $_REQUEST = array_merge($_GET, $_POST); // array_merge not available on version 3
- $request = basename(getenv("REDIRECT_URL"));
- if (count($_REQUEST) > 1000) {
- header("HTTP/1.0 503 Service Unavailable");
- exit;
- }
- if($request==basename(__FILE__)) {
- header("HTTP/1.0 404 Not Found");
- echo 'File Is Not Found';
- }
- $match = array();
- if (! preg_match('@([0-9]{1,2}).([0-9]{1,2}).([0-9]{1,2})@',phpversion(), $match)) {
- $result = preg_match('@([0-9]{1,2}).([0-9]{1,2})@', phpversion(), $match);
- }
- if (isset($match) && ! empty($match[1])) {
- if (! isset($match[2])) {
- $match[2] = 0;
- }
- if (! isset($match[3])) {
- $match[3] = 0;
- }
- } else {
- $phpversion = 0;
- }
- $phpversion = $match[1].'.'.$match[2].$match[3];
- settype($phpversion,"double");
- define('PHPVERSION',$phpversion);
- if(PHPVERSION<4.00) die('<b>Please update your PHP to version 4 or above</b>');
- // Internet Cache Control ( Always Get files from server not from Browser's Cache )
- if(!headers_sent())header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- if(!headers_sent())header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
- if(!headers_sent())header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate"); // HTTP/1.1
- if(!headers_sent())header("Cache-Control: post-check=0, pre-check=0", false);
- if(!headers_sent())header("Pragma: no-cache"); // HTTP/1.0
- if(PHPVERSION>4.10) import_request_variables("gP","FORMS_"); else
- {
- if(isset($_GET)&&is_array($_GET)&&count($_GET)>0) {
- while (list($key,$val)=each($_GET)) {
- $var = 'FORMS_'.$key;
- global $$var;
- $$var = htmlentities(addslashes($val), ENT_QUOTES);
- }
- }
- if(isset($_POST)&&is_array($_POST)&&(count($_POST)>0)) {
- while (list($key,$val)=each($_POST)) {
- $var = 'FORMS_'.$key;
- global $$var;
- $$var = htmlentities(addslashes($val), ENT_QUOTES);
- }
- }
- }
- class configParser {
- var $file;
- var $constants;
- var $RootDir;
- //var $terminal = array(" ","\",'"',"'","+","-","*","/","[","]","(",")","!",";",".",",","=","<",">");
- function configParser(){
- $basename = explode('.',basename(__FILE__));
- $file_ext = array_pop($basename);
- define('FILE_EXT',$file_ext);
- $this->RootDir = str_replace('\','/',dirname(__FILE__));
- define('ROOT_DIR',$this->RootDir);
- $filename = ROOT_DIR.'/config.ini.' . FILE_EXT;
- define('CONFIG_FILE',$filename);
- if(!file_exists($filename)) die('<b>'.basename($filename).' is missing cannot continue</b>');
- $this->file = $filename;
- }
- function parse(){
- if(!file_exists(ROOT_DIR."/cache/constants.".FILE_EXT)||(file_exists(ROOT_DIR."/cache/constants.".FILE_EXT)&&(filemtime($this->file)>(time()-(60*60*(1/60)))))) {
- $source = file($this->file);
- $match = array();
- for($i=0;$i<count($source);$i++) {
- preg_match("/[;[a-zA-Z0-9="'/.'"]].*/",$source[$i],$match);
- if(count($match)>0) {
- $data = explode("=",$match[0]);
- if(count($data)>1) {
- $value = trim(ereg_replace('"|'|;(.*)+',"",$data[1]));
- if(!eregi(' ',trim($data[0]))&&(strlen(trim($data[0]))>3))
- if (isset($last_key_name)&&(isset($value))) { $this->constants[$last_key_name][trim($data[0])] = $value; }
- }else if(eregi("[(.*)]",$match[0])) {
- $last_key_name = trim(ereg_replace("[|]","",$match[0]));
- }
- unset($match);
- unset($value);
- } else {
- if(PHPVERSION<4.10) {
- $comments = explode(";",$source[$i]);
- $value = $comments[0];
- if(isset($value)) {
- $data = explode("=",$value);
- if(count($data)==2) {
- $results = array();
- if(isset($last_key_name)) $results[$last_key_name][trim($data[0])] = trim(ereg_replace('"|'',"",$data[1]));
- }
- }
- } else {
- //print_r($match);
- }
- }
- }
- $this->create_cache();
- } else {
- include(ROOT_DIR."/cache/constants.".FILE_EXT);
- }
- }
-
- function generateClientID() {
- return md5(microtime().uniqid(rand(),true));
- }
-
- function create_cache() {
- if(defined('ROOT_DIR')) {
- if(is_dir(ROOT_DIR)) {
- $fp = @fopen(ROOT_DIR."/cache/constants.".FILE_EXT,"w");
- if(!$fp) $permission_denied = 1;
- if(isset($permission_denied)) {
- if(@mkdir(ROOT_DIR."/cache",0777))
- $fp = @fopen(ROOT_DIR."/cache/constants.".FILE_EXT,"w");
- else {
- $errdesc = 'Permission denied creating cache folder "/cache" on your root folder';
- die($errdesc);
- }
- }
- chmod(ROOT_DIR.'/cache/constants.'.FILE_EXT,0777);
- if($fp) {
- if ($fp) fwrite($fp,"<?");
- while(list($keys,$vals)=each($this->constants)) {
- while(list($key,$val)=each($vals)) {
- $value = trim(ereg_replace('"|'',"",$val));
- if(!(eregi("true",$value)||eregi("false",$value))) $value = """.$value.""";
- if ($fp) fwrite($fp,"rnif(!defined('".$key."')) define("".$key."",".$value.");");
- //if ($fp) fwrite($fp,"rndefine("".$key."",".(((strtolower($value)=='true')||(strtolower($value)=='false'))?((strtolower($value)=='true')?1:0):""".$value.""").");");
- }
- }
- unset($keys);
- unset($key);
- unset($val);
- unset($vals);
- unset($value);
- if ($fp) fwrite($fp,"rn?>");
- }
- if(isset($fp)) fclose($fp);
- include(ROOT_DIR."/cache/constants.".FILE_EXT);
- } else die('<b>Invalid directory specified on DOC_PATH from your configuration file or directory "'.$this->RootDir.'" not found</b>');
- } else die('<b>Document Root System is not defined or cannot find on your '.$this->file.' file</b>');
- }
- }
- class dynamicClass {
- var $dump = false;
- var $trace = false;
- var $error_log = "/logs/errors.log";
-
- function dynamicClass() {
- $drivername = DB_REF;
- global $$drivername;
- if(!is_object($$drivername)) {
- LoadLibrary('dbms');
- //new DBMS;
- }
- $this->db = &$$drivername;
- }
-
- function RaiseError($msg,$type=E_USER_WARNING) {
- if($this->dump) {
- $date = getdate();
- $REMOTE_ADDRESS = getenv('REMOTE_ADDR');
- error_log("[{$date['weekday']} {$date['month']} {$date['mday']} {$date['hours']}:{$date['minutes']}:{$date['seconds']} {$date['year']}] [client {$REMOTE_ADDRESS}] [Error : {$msg}]rn", 3, $this->error_log);
- }
- if($this->trace) trigger_error($msg,$type);
- }
- }
- function getProcessLen() {
- global $time_begin;
- $time_end = microtime();
- return $time_end-$time_begin;
- }
- function LoadLibrary($library_name,$autocreate=true,$vHandle='') {
- if(!defined('ROOT_DIR')&&!defined('SYS_DIR')) {
- trigger_error('<b>Document Root System is not defined or cannot find on your '.CONFIG_FILE.' file</b>',E_USER_ERROR);
- return false;
- } else {
- $lib = ROOT_DIR.SYS_DIR."/".$library_name.'/'.$library_name.'.ini.'.FILE_EXT;
- if(file_exists($lib)) {
- include_once($lib);
- if(($vHandle!='')&&($autocreate)) {
- global $$vHandle;
- $$vHandle = new $library_name();
- }/* else {
- $vHandle = new $library_name();
- }*/
- return true;
- } else {
- trigger_error("<b>Class module <font color="#FF0000">".$library_name."</font></b> was not load properly or file was not found!!",E_USER_ERROR);
- return false;
- }
- }
- }
- function LoadClass($classname) {
- $lib = ROOT_DIR.SYS_DIR.'/'.$classname.'.lib.'.FILE_EXT;
- if(file_exists($lib)) {
- include(ROOT_DIR.'/lib/php4/'.$classname.'.lib.'.FILE_EXT);
- } else {
- trigger_error("<b>Class name <font color="#FF0000">".$classname."</font></b> was not found or file was not found!!",E_USER_ERROR);
- return false;
- }
- }
- function GetAuthentication($title) {
- if (!isset($_SERVER['PHP_AUTH_USER'])) {
- header('WWW-Authenticate: Basic realm="'.addslashes($title).'"');
- header('HTTP/1.0 401 Unauthorized');
- echo "<Script Language='Javascript'>document.write(unescape('%3C%68%74%6D%6C%3E%0A%3C%68%65%61%64%3E%0A%09%3C%74%69%74%6C%65%3E%20%44%61%74%61%62%61%73%65%20%45%72%72%6F%72%3C%2F%74%69%74%6C%65%3E%0A%09%3C%6D%65%74%61%20%68%74%74%70%2D%65%71%75%69%76%3D%22%43%6F%6E%74%65%6E%74%2D%54%79%70%65%22%20%63%6F%6E%74%65%6E%74%3D%22%74%65%78%74%2F%68%74%6D%6C%3B%20%63%68%61%72%73%65%74%3D%49%53%4F%2D%38%38%35%39%2D%31%22%20%2F%3E%0A%09%3C%6D%65%74%61%20%6E%61%6D%65%3D%22%52%4F%42%4F%54%53%22%20%63%6F%6E%74%65%6E%74%3D%22%4E%4F%49%4E%44%45%58%2C%4E%4F%46%4F%4C%4C%4F%57%2C%4E%4F%41%52%43%48%49%56%45%22%20%2F%3E%0A%09%3C%73%74%79%6C%65%20%74%79%70%65%3D%22%74%65%78%74%2F%63%73%73%22%3E%0A%09%3C%21%2D%2D%09%0A%09%62%6F%64%79%20%7B%20%62%61%63%6B%67%72%6F%75%6E%64%2D%63%6F%6C%6F%72%3A%20%77%68%69%74%65%3B%20%63%6F%6C%6F%72%3A%20%62%6C%61%63%6B%3B%20%7D%0A%09%23%63%6F%6E%74%61%69%6E%65%72%20%7B%20%77%69%64%74%68%3A%20%34%30%30%70%78%3B%20%7D%0A%09%23%6D%65%73%73%61%67%65%20%20%20%7B%20%77%69%64%74%68%3A%20%34%30%30%70%78%3B%20%63%6F%6C%6F%72%3A%20%62%6C%61%63%6B%3B%20%62%61%63%6B%67%72%6F%75%6E%64%2D%63%6F%6C%6F%72%3A%20%23%46%46%46%46%43%43%3B%20%7D%0A%09%23%62%6F%64%79%74%69%74%6C%65%20%7B%20%66%6F%6E%74%3A%20%31%33%70%74%2F%31%35%70%74%20%76%65%72%64%61%6E%61%2C%20%61%72%69%61%6C%2C%20%73%61%6E%73%2D%73%65%72%69%66%3B%20%68%65%69%67%68%74%3A%20%33%35%70%78%3B%20%76%65%72%74%69%63%61%6C%2D%61%6C%69%67%6E%3A%20%74%6F%70%3B%20%7D%0A%09%2E%62%6F%64%79%74%65%78%74%20%20%7B%20%66%6F%6E%74%3A%20%38%70%74%2F%31%31%70%74%20%76%65%72%64%61%6E%61%2C%20%61%72%69%61%6C%2C%20%73%61%6E%73%2D%73%65%72%69%66%3B%20%7D%0A%09%61%3A%6C%69%6E%6B%20%20%20%20%20%7B%20%66%6F%6E%74%3A%20%38%70%74%2F%31%31%70%74%20%76%65%72%64%61%6E%61%2C%20%61%72%69%61%6C%2C%20%73%61%6E%73%2D%73%65%72%69%66%3B%20%63%6F%6C%6F%72%3A%20%72%65%64%3B%20%7D%0A%09%61%3A%76%69%73%69%74%65%64%20%20%7B%20%66%6F%6E%74%3A%20%38%70%74%2F%31%31%70%74%20%76%65%72%64%61%6E%61%2C%20%61%72%69%61%6C%2C%20%73%61%6E%73%2D%73%65%72%69%66%3B%20%63%6F%6C%6F%72%3A%20%23%34%65%34%65%34%65%3B%20%7D%0A%09%2D%2D%3E%0A%09%3C%2F%73%74%79%6C%65%3E%0A%3C%2F%68%65%61%64%3E%0A%3C%62%6F%64%79%3E%0A%3C%74%61%62%6C%65%20%63%65%6C%6C%70%61%64%64%69%6E%67%3D%22%33%22%20%63%65%6C%6C%73%70%61%63%69%6E%67%3D%22%35%22%20%69%64%3D%22%63%6F%6E%74%61%69%6E%65%72%22%3E%0A%3C%74%72%3E%0A%09%3C%74%64%20%69%64%3D%22%62%6F%64%79%74%69%74%6C%65%22%20%77%69%64%74%68%3D%22%31%30%30%25%22%3E%41%63%63%65%73%73%20%44%65%6E%69%65%64%3C%2F%74%64%3E%0A%3C%2F%74%72%3E%0A%3C%74%72%3E%0A%09%3C%74%64%20%63%6C%61%73%73%3D%22%62%6F%64%79%74%65%78%74%22%20%63%6F%6C%73%70%61%6E%3D%22%32%22%3E%43%61%6E%6E%6F%74%20%63%6F%6E%74%69%6E%75%65%20%74%6F%20%74%68%65%20%61%63%63%6F%75%6E%74%20%70%61%67%65%73%2E%3C%2F%74%64%3E%0A%3C%2F%74%72%3E%0A%3C%74%72%3E%0A%09%3C%74%64%20%63%6F%6C%73%70%61%6E%3D%22%32%22%3E%3C%68%72%20%2F%3E%3C%2F%74%64%3E%0A%3C%2F%74%72%3E%0A%3C%74%72%3E%0A%09%3C%74%64%20%63%6C%61%73%73%3D%22%62%6F%64%79%74%65%78%74%22%20%63%6F%6C%73%70%61%6E%3D%22%32%22%3E%0A%0A%09%09%50%6C%65%61%73%65%20%74%72%79%20%74%68%65%20%66%6F%6C%6C%6F%77%69%6E%67%3A%20%0A%09%09%3C%75%6C%3E%0A%09%09%09%3C%6C%69%3E%4C%6F%61%64%20%74%68%65%20%70%61%67%65%20%61%67%61%69%6E%20%62%79%20%63%6C%69%63%6B%69%6E%67%20%74%68%65%20%3C%61%20%68%72%65%66%3D%22%23%22%20%6F%6E%63%6C%69%63%6B%3D%22%77%69%6E%64%6F%77%2E%6C%6F%63%61%74%69%6F%6E%20%3D%20%77%69%6E%64%6F%77%2E%6C%6F%63%61%74%69%6F%6E%3B%22%3E%0A%09%09%09%52%65%66%72%65%73%68%3C%2F%61%3E%20%62%75%74%74%6F%6E%20%69%6E%20%79%6F%75%72%20%77%65%62%20%62%72%6F%77%73%65%72%2E%3C%2F%6C%69%3E%0A%09%09%09%3C%6C%69%3E%4F%70%65%6E%20%74%68%65%20%3C%61%20%68%72%65%66%3D%22%2F%22%3E%3C%73%63%72%69%70%74%20%6C%61%6E%67%75%61%67%65%3D%22%6A%61%76%61%73%63%72%69%70%74%22%3E%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%28%77%69%6E%64%6F%77%2E%6C%6F%63%61%74%69%6F%6E%29%3C%2F%73%63%72%69%70%74%3E%3C%2F%61%3E%20%68%6F%6D%65%20%70%61%67%65%2C%20%74%68%65%6E%20%74%72%79%20%74%6F%20%6F%70%65%6E%20%0A%09%09%09%61%6E%6F%74%68%65%72%20%70%61%67%65%2E%3C%2F%6C%69%3E%0A%09%09%09%3C%6C%69%3E%43%6C%69%63%6B%20%74%68%65%20%3C%61%20%68%72%65%66%3D%22%6A%61%76%61%73%63%72%69%70%74%3A%68%69%73%74%6F%72%79%2E%62%61%63%6B%28%31%29%22%3E%42%61%63%6B%3C%2F%61%3E%20%62%75%74%74%6F%6E%20%0A%09%09%09%74%6F%20%74%72%79%20%61%6E%6F%74%68%65%72%20%6C%69%6E%6B%2E%3C%2F%6C%69%3E%0A%0A%09%09%3C%2F%75%6C%3E%0A%09%3C%2F%74%64%3E%0A%3C%2F%74%72%3E%0A%3C%74%72%3E%0A%09%3C%74%64%20%63%6C%61%73%73%3D%22%62%6F%64%79%74%65%78%74%22%20%63%6F%6C%73%70%61%6E%3D%22%32%22%3E%54%68%65%20%3C%61%20%69%64%3D%22%68%6F%73%74%6E%61%6D%65%22%20%68%72%65%66%3D%22%23%22%3E%6C%6F%63%61%6C%68%6F%73%74%3C%2F%61%3E%20%66%6F%72%75%6D%20%74%65%63%68%6E%69%63%61%6C%20%73%74%61%66%66%20%68%61%76%65%20%0A%09%62%65%65%6E%20%6E%6F%74%69%66%69%65%64%20%6F%66%20%74%68%65%20%65%72%72%6F%72%2C%20%74%68%6F%75%67%68%20%79%6F%75%20%6D%61%79%20%3C%61%20%69%64%3D%22%61%64%6D%69%6E%5F%63%6F%6E%74%61%63%74%22%20%68%72%65%66%3D%22%23%22%3E%0A%09%63%6F%6E%74%61%63%74%20%74%68%65%6D%3C%2F%61%3E%20%69%66%20%74%68%65%20%70%72%6F%62%6C%65%6D%20%70%65%72%73%69%73%74%73%2E%3C%2F%74%64%3E%0A%3C%2F%74%72%3E%0A%3C%74%72%3E%0A%09%3C%74%64%20%63%6C%61%73%73%3D%22%62%6F%64%79%74%65%78%74%22%20%63%6F%6C%73%70%61%6E%3D%22%32%22%3E%26%6E%62%73%70%3B%3C%62%72%20%2F%3E%57%65%20%61%70%6F%6C%6F%67%69%73%65%20%66%6F%72%20%61%6E%79%20%69%6E%63%6F%6E%76%65%6E%69%65%6E%63%65%2E%3C%2F%74%64%3E%0A%0A%3C%2F%74%72%3E%0A%3C%2F%74%61%62%6C%65%3E%0A%3C%2F%62%6F%64%79%3E%0A%3C%2F%68%74%6D%6C%3E'));window.onload=function(){document.getElementById('hostname').href='http://".constant('DOMAIN_NAME')."';document.getElementById('hostname').innerHTML='".constant('DOMAIN_NAME')."';document.getElementById('admin_contact').href='mailto:".constant('ADMIN_MAIL')."';}</Script>";
- exit;
- } else {
- return true;
- }
- }
- function DestroyModules() {
- global $_DESTRUCTORS;
- if(is_array($_DESTRUCTORS)) {
- while(list($k,$v)=each($_DESTRUCTORS)) {
- global $$k;
- $handle = $$k;
- $handle->$v();
- }
- }
- }
- register_shutdown_function("DestroyModules");
- $init = new configParser();
- $init->parse();
- if((PHPVERSION<4.10)&&(file_exists(ROOT_DIR.SYS_DIR."/framework/func.400.php"))) include(ROOT_DIR.SYS_DIR."/framework/func.400.php");
- if(file_exists(ROOT_DIR.'/autoload.php')) include(ROOT_DIR.'/autoload.php');
- ?>