function debug_info($level, $info, $message) { global $debug_level, $debug_file; static $init, $time, $uniq, $no = 1; if ($debug_level < $level || empty($debug_file)) { return; } if (!isset($init)) { $init = true; $uniq = uniqid('LOG_'); $time = GetMicrotime(); error_log(sprintf("\n\n%s :: %s :: %s\n", date('ymd H:i:s'), $uniq, $message), 3, $debug_file); return; } $newtime = GetMicrotime(); error_log(sprintf("%s :: %s,%-2d :: %04.2f :: %8s :: %s\n", date('ymd H:i:s'), $uniq, $no++, $newtime - $time, $info, $message), 3, $debug_file); $time = $newtime; }
function localPicture($img_list, &$content, $zoom = 700) { global $db, $setting, $req, $pic_list; for ($i = 0, $m = count($img_list); $i < $m; $i++) { if (array_search($img_list[$i], $pic_list) === false) { array_push($pic_list, $img_list[$i]); } else { continue; } if (strpos($img_list[$i], $setting['web']['url']) !== false) { continue; } if (strpos($img_list[$i], getSetting('web', 'url')) !== false) { continue; } $the_time = GetMicrotime(); $old_name = strtolower(basename($img_list[$i])); $ext = "." . GetFileExt($img_list[$i]); $ext = preg_replace("/\\?.*\$/", "", $ext); $old_name = preg_replace("/\\?.*\$/", "", $old_name); $old_name = preg_replace("/[;,&\\=]/", "", $old_name); //if(strpos("*.jpg.bmp.gif.png",$ext)===false) continue; if ($ext == ".") { $ext = ".jpg"; $old_name .= $ext; } if (strlen($old_name) > 120) { $old_name = substr($old_name, -120); } $new_name = $the_time . $ext; $the_path = ROOT_PATH . "/" . $setting['path']['upload'] . date("/Y/m/d/"); MakeDir($the_path); if (GetRemoteFile($img_list[$i], $the_path . $new_name)) { $img_info = GetImageSize($the_path . $new_name); $the_width = $img_info[0]; $the_height = $img_info[1]; if (!is_numeric($zoom)) { $zoom = 700; } if ($the_width > $zoom) { $the_height *= $zoom / $the_width; $the_width = $zoom; } $data = array(0, 0, 0, $old_name, "image" . str_replace(".", "/", $ext), filesize($the_path . $new_name), '', $the_time, 0, '', $req->getSession('username'), $setting['watermark']['mode'] & 2 ? 1 : 0); $db->insert($setting['db']['pre'] . "attachment", $data); $new_id = $db->GetInsertId(); if ($new_id != 0) { $attach_list .= $new_id . ","; $content = str_replace($img_list[$i], $setting['web']['url'] . "/files?" . $new_id, $content); array_push($id_list, $new_id); } $name_new = $the_time . substr(md5(filesize($the_path . $new_name)), 0, 5) . $ext; rename($the_path . $new_name, $the_path . $name_new); MakeDir("{$the_path}/preview/"); img_thumb($the_path . $name_new, $the_width, $the_height, $the_path . "/preview/" . $name_new); } } return $attach_list; }
function GetResTime() { global $StartTime; return GetMicrotime() - $StartTime; }
public function pageStart($setPlugin = false) { global $setting, $db, $req, $cache; ob_start(); ob_implicit_flush(false); $setting['cookie']['prefix'] .= substr(md5($_SERVER["USERNAME"] . $_SERVER["COMPUTERNAME"] . $_SERVER["OS"]), 0, 4) . "_"; if ($setting['session']['mode'] == "sess_file") { $setting['session']['path'] = ROOT_PATH . "/" . $setting['path']['cache'] . "/session/" . date("Ymd") . "/"; } $req = $this->getInstance("MyReq", $setting['cookie'], $setting['session']); $db = $this->getInstance("MySQL", $setting['db']['host'], $setting['db']['user'], $setting['db']['pass'], $setting['db']['charset']); $cache = $this->getInstance("MyCache", $setting['web']['cache_mode']); includeCache("website"); includeCache("user_group"); includeCache("user_type"); $setting['info'] = array(); $setting['info']['time'] = $_SERVER['REQUEST_TIME']; $setting['info']['time_start'] = GetMicrotime(); $setting['info']['self'] = strtolower(basename($req->getServer("PHP_SELF"))); $setting['info']['web'] = null; $host = $req->getServer("HTTP_HOST"); for ($i = 0, $m = count($GLOBALS['website']); $i < $m; $i++) { if (strpos("," . $GLOBALS['website'][$i]['host'] . ",", "," . $host . ",") !== false) { $GLOBALS['website'][$i]['host'] = $host; $setting['web']['url'] = "http://" . $host; $setting['info']['web'] = $GLOBALS['website'][$i]; break; } } if (is_null($setting['info']['web'])) { $setting['info']['web'] = $GLOBALS['website'][0]; } if ($setting['info']['web'] === false) { $setting['info']['web'] = getParaInfo("website", "web_id", 1); } $setting_sub = getSubSetting($setting['info']['web']['web_id']); $setting_sub['web']['url'] = $setting['web']['url']; $setting['db_sub'] = $setting_sub['db']; if ($setting['db']['name'] == $setting_sub['db']['name']) { $setting['db']['pre_sub'] = $setting_sub['db']['pre']; } else { $setting['db']['pre_sub'] = $setting_sub['db']['name'] . "." . $setting_sub['db']['pre']; } unset($setting_sub['db']); $setting = arrayMerge($setting, $setting_sub); $req->init($setting['cookie'], $setting['session']); if ($setPlugin) { $this->setPlugin(); } $this->getLanguage(ROOT_PATH . "/source/language/"); $setting['language'] = $this->language; $req->SessionStart($GLOBALS['sess_handle']); $max_count = count($this->func_start); for ($i = 0; $i < $max_count; $i++) { call_user_func($this->func_start[$i]); } if (checkSign(1)) { return; } $username = $req->getSession("username"); if (empty($username) || $username == "Guest") { $this->logcheck(); } $req->setSession("url", "http://" . $req->getServer("HTTP_HOST") . $req->getServer("URL")); $req->setSession("ip", GetIp()); $setting['info']['user'] = array(); $setting['info']['user']['name'] = $req->getSession("username"); $setting['info']['user']['group'] = getParaInfo("user_group", "group_id", $req->getSession('usergroup')); $setting['info']['user']['type'] = getParaInfo("user_type", "type_id", $req->getSession('usertype')); if ($setting['info']['user']['type'] === false) { $setting['info']['user']['type'] = array('type_id' => '1', 'type_name' => 'Guest', 'view_lvl' => '0'); } $this->regAjax("reset_psw", "MyStep::ajax_reset_psw"); }
function Run() { $startTime = GetMicrotime(); foreach ($this->PackageFiles as $packageFile) { $packageFile->CreateFile(); } $execTime = GetMicrotime() - $startTime; $execTime = number_format($execTime, 10); switch ($this->_TotalFiles) { case 0: echo 'No files defined'; break; case 1: echo 'The generation of the package file has been completed in ' . $execTime . ' seconds.'; break; default: echo 'The generation of ' . $this->_TotalFiles . ' files has been completed in ' . $execTime . ' seconds.'; break; } }
function ShowFooter() { global $startTime, $color, $rendb_count, $cfg; $passtime = GetMicrotime() - $startTime; eval('echo "' . LoadTemplate('footer') . '";'); exit; }
<?php //error_reporting(E_ERROR | E_WARNING | E_PARSE); function GetMicrotime() { $t = explode(' ', microtime()); return intval(($t[1] + $t[0]) * 1000); } $startTime = GetMicrotime(); // define('IN_RBB', true); set_magic_quotes_runtime(0); //var_dump($name); //注册变量 if (!get_cfg_var('register_globals') || !get_magic_quotes_gpc()) { if (is_array($HTTP_POST_VARS)) { foreach ($HTTP_POST_VARS as $key => $value) { if (!is_array($value)) { ${$key} = addslashes($value); } } } if (is_array($HTTP_GET_VARS)) { foreach ($HTTP_GET_VARS as $key => $value) { if (!is_array($value)) { ${$key} = addslashes($value); } } } } //echo "<PRE>";