Discuz
访客站。默认情况下,将显示 IP
的前三个段,即 127.0.0。十,。
既然我们选择为游客发帖,我们也可以尽最大努力保护游客的知识产权不被泄露。
然后修改 discuz
文件并更改代码:
/找到 source
/module
/forum
/forum_uviewthread
.php
文件
查找:if
($post
[‘authorid
’])){
那么这两句话,
if
(!$post
[‘authorid
’]) {- $
post
[‘useip
’] =substr
($post
[‘useip
’], 0,strrpos
($post
[‘useip
’], ‘.’)).’.x
’; - }
- 如果只显示前面 2 段就修改成:
if
(!$post
[‘authorid
’]) {if
($_G
[‘adminid
’] != 1) {- $
tmpip
=substr
($post
[‘useip
’], 0,strrpos
($post
[‘useip
’], ‘.’)); - $
post
[‘useip
’] =substr
($post
[‘useip
’], 0,strrpos
($tmpip
, ‘.’)).’.x
.x
’; - }
- }
- 如果要全部不显示就修改成:
if
(!$post
[‘authorid
’]) {if
($_G
[‘adminid
’] != 1) {- $
tmpip
=substr
($post
[‘useip
’], 0,strrpos
($post
[‘useip
’], ‘.’)); - $
post
[‘useip
’] =substr
($post
[‘useip
’], 0,strrpos
($tmpip
, ‘x
’)).’x
.x
’; - }
- }
- 保存替换下文件就行了,当然记得先备份下原文件,以及修改的地方要备注下。
转载请注明:汇站网 » discuz
修改游客发帖隐藏 ip
的方法