zblog评论链接URL跳转源码给评论内的链接添加二次跳转页面设置URL跳转策略

2018-10-21
1评论
/
1592阅读
爱搜啊

评论内网址跳转修改添加,最近发现很多通过在本站评论留很多链接的垃圾评论,最近有时间稍微修改了下把评论里面的链接二次跳转的方法,今天说下如何实现的

首先使用FTP软件打开主题文件内的comment.php文件源码如下,这个文件是评论列表模版。这里以zblog小小蚂蚁模版为例。也就是本站现在使用的模版

<ul>
  <li class="revertcomment">
    <a rel="nofollow" title="回复" href="#cmt{$comment.ID}" onclick="zbp.comment.reply('{$comment.ID}')">回复</a></li>
  <li class="msgname">
    <span class="num">{if $comment.FloorID > '0'}{$comment.FloorID}楼{else}New{/if}</span>
    <a rel="nofollow" href="https://iqqoz.com/url.php?url={$comment.Author.HomePage}" title="{$comment.Author.StaticName}" target="_blank">{$comment.Author.StaticName}</a>//只需要把这一行的里面的链接替换为跳转链接即可
    <time>{$comment.Time()}</time></li>
  <li class="msgarticle">{$comment.Content}{foreach $comment.Comments as $comment}{template:comment}{/foreach}</li>
</ul>

{$comment.Author.HomePage}函数的意思是评论框如图

zblog评论链接URL跳转源码给评论内的链接添加二次跳转页面设置URL跳转策略

只需要把此函数替换为https://iqqoz.com/url.php?url={$comment.Author.HomePage}即可实现二次评论内链接二次跳转

下面是rul.php文件源码只需要复制源码,新建url.php文件粘贴,放在网站根目录即可

<?php
if (!preg_match("/^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+$/",$_GET['url'])){
echo '网址错误';
exit();
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="refresh" content="3.0;url=<?php echo $_GET['url'];?>">
<title>爱搜啊博客跳转页面</title>
</head>
<body>
<TABLE width=760 height=321 border=0 align=center cellPadding=5 cellSpacing=1 bgcolor="eeeeee">
<TR>
<TD align=center vAlign=center bgcolor="#FFFFFF">
<p>正在为您打开</p>
<br>
<p><?php echo $_GET['url'];?></p>
<br>
<p>所花时间取决于该站的连接速度和当前网速,请耐心等待。<br>
</p>
</TD></TR></TABLE>
</body>
</html>

本站附件分享,如果附件失效,可以去找找看

诚通网盘附件百度网盘附件


于2018-10-21发布