⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.php

📁 转载: 1、留言内容不良词语过滤 2、版主可修改留言内容 3、能把留言删除到回收站 4、可批量删除留言 5、留言前可先预览 6、UBB 标签代码支持 7、随机选择头像和表情
💻 PHP
字号:
<?php
#####################################
##  名 称 :雨虹留言板  YHPbook    ##
##  设 计 :绿叶软件营 -> 蓝鸟     ##
##  展 示 :http://lvsoft.126.com  ##
##  电 邮 : lvsoft@tom.com         ##
#####################################

$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
$gb_time = time();    /// 取得系统时间戳

/// 获取IP地址
if(getenv('HTTP_CLIENT_IP')) {
	$gb_ip = getenv('HTTP_CLIENT_IP');
} elseif(getenv('HTTP_X_FORWARDED_FOR')) {
	$gb_ip = getenv('HTTP_X_FORWARDED_FOR');
} elseif(getenv('REMOTE_ADDR')) {
	$gb_ip = getenv('REMOTE_ADDR');
} else {
	$gb_ip = $_SERVER['REMOTE_ADDR'];
}

define("Verion","1.6.0");
define("Verinfo","1.6.0.11 50412");

/////////////////////////////////////////////
function gettime(){   // 获取当前时间戳
	$mtime = explode(' ', microtime());
	$time = $mtime[1] + $mtime[0];
	return $time;
}

function CheckAdmin(){    /// 验证管理员
   global $config;
   $key = $_COOKIE['abc'];
   if($key == md5($config[pass])){
	   return true;
   }else{
	   return false;
   }
}

function checktu($tu){
	if(strlen($tu)<=2 and !eregi("([^0-9])",$tu))return true;else return false;
}
function checkQ($num){   /// 验证Q号
	if(strlen($num)<=15 and strlen($num)>=7 and !eregi("([^0-9])",$num))
		return true;
	else
		return false;
}
function checkY($num){   /// 验证
	if(ereg("[^a-zA-Z0-9_-]",$num))
		return true;
	else
		return false;
}
function checkmail($nmail){   /// 验证电子邮件地址
	if(ereg("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+",$nmail))
		return true;
	else
		return false;
}
function checkurl($nurl){   /// 验证主页地址
	if (ereg("^[_a-zA-Z0-9-]+(\.[\/_a-zA-Z0-9-]+)*$", $nurl))
		return true;
	else
		return false; 
} 

function message($msg){   /// 留言内容过滤
    $msg=ereg_replace("\r\n","[br]",$msg);
    $msg=ereg_replace("\r","[br]",$msg);
    $msg=ereg_replace("\t","",$msg);
    $msg=ereg_replace("\n","",$msg);
    $msg=ereg_replace("  "," ",$msg);
    $msg=htmlspecialchars($msg);
	return $msg;
}
function replymsg($msg){   /// 回复内容过滤
    $msg=ereg_replace("\r\n","",$msg);
    $msg=ereg_replace("\r","",$msg);
    $msg=ereg_replace("\t","",$msg);
    $msg=ereg_replace("\n","",$msg);
    $msg=ereg_replace("  "," ",$msg);
    $msg=htmlspecialchars($msg);
	return $msg;
}

function ubb($Text) {      /// UBB代码转换
//$Text=htmlspecialchars($Text);
//$Text=ereg_replace("\r\n","<br>",$Text);
$Text=ereg_replace("\[br\]","<br>",$Text);
$Text=nl2br($Text); 
$Text=stripslashes($Text);
$Text=preg_replace("/\\t/is"," ",$Text);
$Text=preg_replace("/\[url\](http:\/\/.+?)\[\/url\]/is","<a href=\\1 target=_blank><u>\\1</u></a>",$Text);
$Text=preg_replace("/\[url\](.+?)\[\/url\]/is","<a href=\"http://\\1\" target=_blank><u>http://\\1</u></a>",$Text); 
$Text=preg_replace("/\[url=(http:\/\/.+?)\](.*)\[\/url\]/is","<a href=\\1 target=_blank><u>\\2</u></a>",$Text);
$Text=preg_replace("/\[url=(.+?)\](.*)\[\/url\]/is","<a href=http://\\1 target=_blank><u>\\2</u></a>",$Text);
$Text=preg_replace("/\[color=(.+?)\](.+?)\[\/color\]/is","<font color=\\1>\\2</font>",$Text);
$Text=preg_replace("/\[font=(.+?)\](.+?)\[\/font\]/is","<font face=\\1>\\2</font>",$Text);
$Text=preg_replace("/\[email=(.+?)\](.+?)\[\/email\]/is","<a href= mailto:\\1>\\2</a>",$Text);
$Text=preg_replace("/\[email\](.+?)\[\/email\]/is","<a href= mailto:\\1>\\1</a>",$Text);
$Text=preg_replace("/\[i\](.+?)\[\/i\]/is","<i>\\1</i>",$Text);
$Text=preg_replace("/\[u\](.+?)\[\/u\]/is","<u>\\1</u>",$Text);
$Text=preg_replace("/\[b\](.+?)\[\/b\]/is","<b>\\1</b>",$Text);
$Text=preg_replace("/\[fly\](.+?)\[\/fly\]/is","<marquee width=98% behavior=alternate scrollamount=3>\\1</marquee>",$Text);
$Text=preg_replace("/\[move\](.+?)\[\/move\]/is","<marquee width=98% scrollamount=3>\\1</marquee>",$Text);
$Text=preg_replace("/\[shadow=([#0-9a-z]{1,10})\,([0-9]{1,3})\,([0-9]{1,2})\](.+?)\[\/shadow\]/is","<table width=*><tr><td style=\"filter:shadow(color=\\1, direction=\\2 ,strength=\\3)\">\\4</td></tr></table>",$Text);
return $Text;
}

function encodemail($mail){    /// E-mail代码化
	$char = "";
	$email = "";
	$num=strlen($mail);
	for($i=0;$i<$num;$i++){
		$temp = substr($mail,$i,1);
		$char = "&#".ord($temp).";";
		$email.=$char;
	}
	return $email;
}

function error($msg){   // 出错提示页面
   global $config;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta HTTP-EQUIV="REFRESH" CONTENT="3;URL='javascript:history.back();'">
<link rel="stylesheet" href="images/style.css">
<title>操作错误</title>
</head>
<body bgcolor="#9BCBFB">
<p align="center">&nbsp;</p>    
<p align="center">&nbsp;</p>    
<p align="center">&nbsp;</p>    
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="1" width="400" height="38" bgcolor="#000000">
    <tr>
      <td width="100%" align="center" height="23" background="images/table.gif"><font color="#FFFFFF"><?echo$config[bookname];?></font></td>
    </tr>
    <tr>
      <td width="100%" align="center" height="38" bgcolor="#FFFFFF">
        <table border="0" cellpadding="0" cellspacing="0" width="100%" height="93">
          <tr>
            <td width="31%" height="93" align="center"><font style="font-size: 50pt" face="Wingdings" color="ff0000">L</font></td>
            <td width="61%" height="93" style="font-size:11pt;"><font color="#008000"><?echo$msg;?></font></td>
            <td width="8%" height="93"></td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  </center>
</div>
<p align="center">如你的浏览器没自动返回,<a href="javascript:history.back();">请点这里</a></p>
</body>
</html>
<?
 exit();
}

function success($title,$msg,$zurl){   // 成功提示页面
   global $config;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta HTTP-EQUIV="REFRESH" CONTENT="3;URL=<?echo$zurl;?>">
<link rel="stylesheet" href="images/style.css">
<title><?echo$title;?></title>
</head>
<body bgcolor="#9BCBFB">
<p align="center">&nbsp;</p>    
<p align="center">&nbsp;</p>    
<p align="center">&nbsp;</p>    
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="1" width="400" height="38" bgcolor="#000000">
    <tr>
      <td width="100%" align="center" height="23" background="images/table.gif"><font color="#FFFFFF"><?echo$config[bookname];?></font></td>
    </tr>
    <tr>
      <td width="100%" align="center" height="38" bgcolor="#FFFFFF">
        <table border="0" cellpadding="0" cellspacing="0" width="100%" height="93">
          <tr>
            <td width="31%" height="93" align="center"><font style="font-size: 50pt" face="Wingdings" color="#0000FF">J</font></td>
            <td width="61%" height="93" style="font-size:11pt;"><font color="#008000"><?echo$msg;?></font></td>
            <td width="8%" height="93"></td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  </center>
</div>
<p align="center">如你的浏览器没自动返回,<a href="<?echo$zurl;?>">请点这里</a></p>
</body>
</html>
<?
 exit();
}

function wqx($msg){
   global $config;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta HTTP-EQUIV="REFRESH" CONTENT="3;URL=index.php">
<link rel="stylesheet" href="images/style.css">
<title>非法操作</title>
</head>
<body bgcolor="#9BCBFB">
<p align="center">&nbsp;</p>    
<p align="center">&nbsp;</p>    
<p align="center">&nbsp;</p>    
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="1" width="400" height="38" bgcolor="#000000">
    <tr>
      <td width="100%" align="center" height="23" background="images/table.gif"><font color="#FFFFFF"><?echo$config[bookname];?></font></td>
    </tr>
    <tr>
      <td width="100%" align="center" height="38" bgcolor="#FFFFFF">
        <table border="0" cellpadding="0" cellspacing="0" width="100%" height="93">
          <tr>
            <td width="31%" height="93" align="center"><font style="font-size: 50pt" face="Wingdings" color="ff0000">K</font></td>
            <td width="61%" height="93" style="font-size:11pt;"><font color="#008000"><?echo$msg;?></font></td>
            <td width="8%" height="93"></td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  </center>
</div>
<p align="center">如你的浏览器没自动返回,<a href="index.php">请点这里</a></p>
</body>
</html>
<?
exit();
}

function ipwhere($ip){   /// 取出IP地理位置
	global $datapath;

	list($ip1,$ip2,$ip3,$ip4)=explode(".",$ip);
	$ips=$ip1*16777216+$ip2*65536+$ip3*256+$ip4;

    if (file_exists($datapath."/ip.dat"))
        $ipfile=$datapath."/ip.dat";
    else
       return "未知";

	$fp = fopen($ipfile,"r");
	$data = fgets($fp,500);
	while(!feof($fp)){
		$data = fgets($fp,500);
		$line = explode("X",$data);
		$sip = HexDec($line[0]);
		$eip = HexDec($line[1]);
		if ($ips<=$eip and $ips>=$sip){
			$fromwhere = chop($line[2]);
			break;
		}
	}
	fclose($fp);

	return $fromwhere;
}

function online(){   /// 当前在线统计
	global $datapath,$gb_ip,$gb_time;

	$onlin=1;
    $check = 0;
	$filename = "${datapath}/online.php";
	$online=file($filename);
	$no = count($online);
	for ($i=0;$i<$no;$i++){
		$_=$online[$i];
		$_ = ereg_replace("\n","",$_);
		list($ip,$time)=explode("\t",$_);
		$flag=$gb_time-$time;
		if (($ip == $gb_ip)and($flag < 600 and $flag > 0)) {
			$data = $data."$gb_ip\t$gb_time\n";
			$check=1;
		}
		elseif ($flag < 600 and $flag > 0) {
			$data = $data.$_."\n";
			$onlin++;
		}
	}
	if ($check == 0) {
		$data = $data."$gb_ip\t$gb_time\n";
	}
	$fp=fopen("$filename","w");
	flock($fp,LOCK_EX);
	fputs($fp,$data);
	fclose($fp);

 return $onlin;
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -