Skip to content


discuz论坛找出贴子中所有外部链接

最近风声很紧,要自查下bbs中包含外链的贴子,以下为sql语句。


SELECT pid, fid, tid, author, authorid, FROM_UNIXTIME( dateline ) AS time, subject, message
FROM `cdb_posts`
WHERE `message`
REGEXP ‘.*http://[^bbs.domain.com].*’

REGEXP为排除自已的域名。
500W贴子执行时间在0.1秒左右,速度还算可以。
在phpmyadmin下搜出结果后,打开翻页下面的options,选中”完整文字”就可以看到完整贴子,再配合后台的禁止用户和删贴功能就可以把垃圾消灭了。

ps:如果执行速度比较慢可以加上pid的限制或者先导出到一个临时表中。

Posted in Discuz/Uchome/Ucenter, 其它.

Tagged with , .


No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.