标题:帮个忙,很急!~~~~~~~````
只看楼主
okdelong
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2004-6-2
 问题点数:0 回复次数:6 
帮个忙,很急!~~~~~~~````

<? foreach($flat_messages as $fmessage) { $fmessage->name = htmlspecialchars($fmessage->name); $fmessage->email = htmlspecialchars($fmessage->email); $fmessage->subject = htmlspecialchars($fmessage->subject); $fmessage->message = htmlspecialchars($fmessage->message); $fmessage->message = str_replace("

","<div class=\"quote\">",$fmessage->message); $fmessage->message = str_replace("
","</div>",$fmessage->message); $fmessage->message = preg_replace("/(\[img\])(.*?)(\[\/img\])/s","<img src=\"\\2\" border=\"0\" alt='点击查看原图' onload=\"if(this.width>screen.width-333) {this.width=screen.width-333;this.alt=\'点击查看原图!\';}\" onmouseover=\"if(this.alt) this.style.cursor=\'hand\';\" onclick=\"window.open(\'\\2\\');\">", $fmessage->message); // urls $fmessage->message = preg_replace("/(\[url\])(.*?)(\[\/url\])/s","<a href=\"\\2",$fmessage->message'>\\2\">\\2</a>",$fmessage->message); $fmessage->message = preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/s","<a href=\"\\2",$fmessage->message'>\\1\">\\2</a>",$fmessage->message); // bold $fmessage->message = preg_replace("/(\[b\])(.*?)(\[\/b\])/s","<strong>\\2</strong>",$fmessage->message); // underline $fmessage->message = preg_replace("/(\[u\])(.*?)(\[\/u\])/s","<u>\\2</u>",$fmessage->message); // italic $fmessage->message = preg_replace("/(\[i\])(.*?)(\[\/i\])/s","<em>\\2</em>",$fmessage->message); reset($message_emoticons); while (list($emo_txt,$emo_src)=each($message_emoticons)) { $fmessage->message=str_replace($emo_txt,$emo_src,$fmessage->message); } ?>

这段代码是我的PHP论坛上的代码。

请问这段代码是不是起到把UBB代码替换成HTML的,

我想论坛接受HTML代码型式。

该怎么办呢。。

帮帮我!~~~~

搜索更多相关主题的帖子: message email 
2004-06-02 14:24
好学
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
帖 子:622
专家分:318
注 册:2004-5-4
得分:0 
好像把转换UBB的能力去掉以后就可以接受HTML,不过如果没有HTML过滤功能的话别人用一些恶意代码会使你的论坛没法运作
2004-06-02 14:36
okdelong
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2004-6-2
得分:0 

对对,楼上的朋友所说的“把转换UBB的能力去掉该怎么实现在啊。

我要的就是这样。请帮帮我。

2004-06-02 14:57
好学
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
帖 子:622
专家分:318
注 册:2004-5-4
得分:0 
去掉相关的代码不就行了,我没看过PHP,对你的代码,你自己才熟悉啊
2004-06-02 15:15
好学
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
帖 子:622
专家分:318
注 册:2004-5-4
得分:0 

[QUOTE]// urls $fmessage->message = preg_replace("/(\[url\])(.*?)(\[\/url\])/s","<a href=\"message'>\\2\">\\2",$fmessage->message">\\2",$fmessage->message'>\\2\">\\2</a>",$fmessage->message); $fmessage->message = preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/s","<a href=\"message'>\\1\">\\2",$fmessage->message">\\2",$fmessage->message'>\\1\">\\2</a>",$fmessage->message); // bold $fmessage->message = preg_replace("/(\[b\])(.*?)(\[\/b\])/s","<strong>\\2</strong>",$fmessage->message); // underline $fmessage->message = preg_replace("/(\[u\])(.*?)(\[\/u\])/s","<u>\\2</u>",$fmessage->message); // italic $fmessage->message = preg_replace("/(\[i\])(.*?)(\[\/i\])/s","<em>\\2</em>",$fmessage->message);[/QUOTE]

至少这部分要去掉(如果这段代码是负责转换UBB代码为HTML的话),看“message” 感觉象是管理发短信的代码

preg_replace就是转换的函数吧,我没学过PHP,完全是望文生义噢

2004-06-02 15:23
LGZXL1984
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2004-6-3
得分:0 

晕 我怎么看不懂呀``

2004-06-03 21:59
蓝儿木
Rank: 1
等 级:新手上路
帖 子:14
专家分:5
注 册:2014-11-4
得分:0 
我也看不懂啊
2014-11-04 10:25



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-1932-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.144870 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved