/**
 * 错误处理
 * @param string $message 错误信息
 * @param bool $show 是否显示
 * @param bool $save 是否保存
 * @param bool $halt 是否停止
 * @return void
 */
function systemError($message, $show = true, $save = true, $halt = true)
{
    require_once fimport('class/error');
    FanweError::systemError($message, $show, $save, $halt);
}
 function error($message, $tpl_name)
 {
     require_once fimport('class/error');
     FanweError::templateError($message, $tpl_name);
 }
Пример #3
0
 function halt($message = '', $sql = '')
 {
     require_once fimport('class/error');
     FanweError::dbError($message, $sql);
 }
Пример #4
0
 /**  
  * 写入错误日志 
  * @param string $message 错误提示
  * @return void
  */
 function writeErrorLog($message)
 {
     global $_FANWE;
     $message = FanweError::clear($message);
     $time = TIMESTAMP;
     $file = FANWE_ROOT . './public/logs/error' . date("Ym") . '.log.php';
     $hash = md5($message);
     $user = '******' . $_FANWE['uid'] . '; IP=' . $_FANWE['client_ip'] . '; RIP:' . $_SERVER['REMOTE_ADDR'];
     $uri = 'Request: ' . htmlspecialchars(FanweError::clear($_SERVER['REQUEST_URI']));
     $message = "<?PHP exit;?>\t{$time}\t{$message}\t{$hash}\t{$user} {$uri}\n";
     if ($fp = @fopen($file, 'rb')) {
         $lastlen = 10000;
         $maxtime = 60 * 10;
         $offset = filesize($file) - $lastlen;
         if ($offset > 0) {
             fseek($fp, $offset);
         }
         if ($data = fread($fp, $lastlen)) {
             $array = explode("\n", $data);
             if (is_array($array)) {
                 foreach ($array as $key => $val) {
                     $row = explode("\t", $val);
                     if ($row[0] != '<?PHP exit;?>') {
                         continue;
                     }
                     if ($row[3] == $hash && $row[1] > $time - $maxtime) {
                         return;
                     }
                 }
             }
         }
     }
     error_log($message, 3, $file);
 }