有效防止外链广告!!!修改discuz的URL代码
2009-08-06 08:57
477 查看
教你有效防止外链广告!!!修改discuz的URL代码
我把论坛里的URL自带 discuz代码改了.
当会员发贴时,内容里有URL则全都改内嵌模式的,这样搜索引擎就不会认为是外链了
演示地址请点这个,然后查看二楼和三楼的链接
:http://www.qhdok.com/thread-1448-1-1.html
2009年3月18日修改:把所有非站内URL都改成内嵌的了
http://www.qhdok.com/home/link.php?url=http://www.baidu.com
http://www.qhdok.com/home/link.php?url=http://www.baidu.com
复制代码
2009年3月18日修改:把所有非站内URL都改成内嵌的了
是修改include/discuzcode.func.php里的东西,当然,要把里面的qhdok.com改成自己的网址
function parseurl($url, $text) {
if(!$url &&
preg_match("/((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k|thunder|synacast){1}:////|www/.)[^/[/"']+/i",
trim($text), $matches)) {
$url = $matches[0];
$returnval="";
$length = 65;
if(strlen($url) > $length) {
$text = substr($url, 0, intval($length * 0.5)).' ... '.substr($url, - intval($length * 0.3));
}
$temp=$url;
$temp=str_replace("www.","",str_replace("http://","",$temp));
if(substr($temp,0,9)=="qhdok.com"){
if(substr($url,0,4)!="http"){
$url="http://".$url;
}
$returnval="<a href=".$url." target=_blank>".$text."</a>";
}else{
$returnval='<a
href="http://www.qhdok.com/home/link.php?url='.(substr(strtolower($url),
0, 4) == 'www.' ? 'http://'.$url : $url).'"
target="_blank">'.$text.'</a>';/*改了这里URL内嵌*/
}
return $returnval;
} else {
if(substr($url,0,1)=="="){
$url = substr($url, 1);
}
if(substr(strtolower($url), 0, 4) == 'www.') {
$url = 'http://'.$url;
}
$returnval="";
$temp=$url;
$temp=str_replace("www.","",str_replace("http://","",$temp));
if(substr($temp,0,9)=="qhdok.com"){
$returnval="<a href=".$url." target=_blank>".$text."</a>";
}else{
$returnval='<a
href="http://www.qhdok.com/home/link.php?url='.$url.'"
target="_blank">'.$text.'</a>';/*改了这里URL内嵌*/
}
return $returnval;
}
}
复制代码
.
还要修改一下home/link.php文件中的//游客直接跳转下面加//
if(empty($space)) {
//游客直接跳转
//showmessage('do_success', $url, 0);
}
复制代码
.
找到home/template/default/iframe.htm文件.
.
<td height="26" class="link_td">
<img src="image/icon/profile.gif"
align="absmiddle"> <a target="_blank"
href="http://www.qhdok.com/home/">返回我的空间</a> <span
class="pipe">|</span>
<img src="image/icon/share.gif"
align="absmiddle"> <a target="_blank"
href="http://www.qhdok.com/">秦皇岛论坛</a> <span
class="pipe">|</span>
<img src="image/icon/network.gif"
align="absmiddle"> <a target="_blank"
href="http://www.qhdok.com/qinhuangdaoditu.htm">秦皇岛地图</a>
<span class="pipe">|</span>
<img src="image/icon/profile.gif"
align="absmiddle"> <a href="javascript:;"
onClick="javascript:setCopy('http://www.qhdok.com/home/link.php?url=$url');return
false;">点击分享给朋友</a>
</td>
复制代码
OK!!!全改完了,别忘了更新缓存哦~!
转自:http://www.qhdok.com/thread-1448-1-1.html
教你有效防止外链广告!!!修改discuz的URL代码 - 秦皇岛论坛事务 - 秦皇岛论坛
我把论坛里的URL自带 discuz代码改了.
当会员发贴时,内容里有URL则全都改内嵌模式的,这样搜索引擎就不会认为是外链了
演示地址请点这个,然后查看二楼和三楼的链接
:http://www.qhdok.com/thread-1448-1-1.html
2009年3月18日修改:把所有非站内URL都改成内嵌的了
http://www.qhdok.com/home/link.php?url=http://www.baidu.com
http://www.qhdok.com/home/link.php?url=http://www.baidu.com
复制代码
2009年3月18日修改:把所有非站内URL都改成内嵌的了
是修改include/discuzcode.func.php里的东西,当然,要把里面的qhdok.com改成自己的网址
function parseurl($url, $text) {
if(!$url &&
preg_match("/((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k|thunder|synacast){1}:////|www/.)[^/[/"']+/i",
trim($text), $matches)) {
$url = $matches[0];
$returnval="";
$length = 65;
if(strlen($url) > $length) {
$text = substr($url, 0, intval($length * 0.5)).' ... '.substr($url, - intval($length * 0.3));
}
$temp=$url;
$temp=str_replace("www.","",str_replace("http://","",$temp));
if(substr($temp,0,9)=="qhdok.com"){
if(substr($url,0,4)!="http"){
$url="http://".$url;
}
$returnval="<a href=".$url." target=_blank>".$text."</a>";
}else{
$returnval='<a
href="http://www.qhdok.com/home/link.php?url='.(substr(strtolower($url),
0, 4) == 'www.' ? 'http://'.$url : $url).'"
target="_blank">'.$text.'</a>';/*改了这里URL内嵌*/
}
return $returnval;
} else {
if(substr($url,0,1)=="="){
$url = substr($url, 1);
}
if(substr(strtolower($url), 0, 4) == 'www.') {
$url = 'http://'.$url;
}
$returnval="";
$temp=$url;
$temp=str_replace("www.","",str_replace("http://","",$temp));
if(substr($temp,0,9)=="qhdok.com"){
$returnval="<a href=".$url." target=_blank>".$text."</a>";
}else{
$returnval='<a
href="http://www.qhdok.com/home/link.php?url='.$url.'"
target="_blank">'.$text.'</a>';/*改了这里URL内嵌*/
}
return $returnval;
}
}
复制代码
.
还要修改一下home/link.php文件中的//游客直接跳转下面加//
if(empty($space)) {
//游客直接跳转
//showmessage('do_success', $url, 0);
}
复制代码
.
找到home/template/default/iframe.htm文件.
.
<td height="26" class="link_td">
<img src="image/icon/profile.gif"
align="absmiddle"> <a target="_blank"
href="http://www.qhdok.com/home/">返回我的空间</a> <span
class="pipe">|</span>
<img src="image/icon/share.gif"
align="absmiddle"> <a target="_blank"
href="http://www.qhdok.com/">秦皇岛论坛</a> <span
class="pipe">|</span>
<img src="image/icon/network.gif"
align="absmiddle"> <a target="_blank"
href="http://www.qhdok.com/qinhuangdaoditu.htm">秦皇岛地图</a>
<span class="pipe">|</span>
<img src="image/icon/profile.gif"
align="absmiddle"> <a href="javascript:;"
onClick="javascript:setCopy('http://www.qhdok.com/home/link.php?url=$url');return
false;">点击分享给朋友</a>
</td>
复制代码
OK!!!全改完了,别忘了更新缓存哦~!
转自:http://www.qhdok.com/thread-1448-1-1.html
教你有效防止外链广告!!!修改discuz的URL代码 - 秦皇岛论坛事务 - 秦皇岛论坛
相关文章推荐
- 收藏php防止外链的一段url代码
- 修改验证码为加法运算问题,有效防止广告信息
- 如何修改frameworks层代码并使修改有效
- JS 修改URL参数(实现代码)
- 如何有效防止域名被电信服务商劫持(电信114弹窗广告)
- 使用JavaScript修改浏览器URL地址栏的实现代码
- Android使用Gradle命令动态修改BASE_URL(测试/正式环境地址)完成打包,不需要修改代码
- .NET:防止并发修改 之 离线乐观锁代码示例
- 使用JavaScript修改浏览器URL地址栏的实现代码
- dedecms防止FCK乱格式化你的代码的修改方法
- dedecms防止FCK乱格式化你的代码的修改方法
- php URL跳转代码 减少外链
- 如何对自己的代码做成库文件,防止修改或者查看
- 防止并发修改 之 离线乐观锁代码示例
- 一段可以【检测设备终端】和【挖掘url中广告信息】的代码
- JavaScript修改浏览器URL地址栏的代码
- 如何有效去掉优酷网站上的广告代码
- 修改代码防止zend db出错时把密码输出
- php原子性操作测试,有效防止多进程对同一段代码的重复执行