Премахване на символи в изречението

ExpressYourself

Registered
Има ли начин когато напиша нещо и му сложа bbcode и става
Код:
[b][/b][u][/u][i][/i][size=1][/size][color=#123123][/color]
Да ги премахва и да изпраща съобщението без тях
 
ExpressYourself каза:
Има ли начин когато напиша нещо и му сложа bbcode и става
Код:
[b][/b][u][/u][i][/i][size=1][/size][color=#123123][/color]
Да ги премахва и да изпраща съобщението без тях
Код:
<?php
$comment=$_POST['comment'];
$comment = str_replace("[b]","<b>","$comment");
$comment = str_replace("[/b]","</b>","$comment");
$comment = str_replace("[code]","<textarea>","$comment");
$comment = str_replace("
","</textarea>","$comment");
$comment = str_replace("","<i>","$comment");
$comment = str_replace("
","</i>","$comment");
$comment = str_replace("","<font size='14'>","$comment");
$comment = str_replace("
","</font>","$comment");
$comment = str_replace("","<font color='#ffffff'>","$comment");
$comment = str_replace("
","</font>","$comment");
echo $comment;
?>[/code]
Надявам се, че схвана принципа..
 
DeathGuard_ каза:
ExpressYourself каза:
Има ли начин когато напиша нещо и му сложа bbcode и става
Код:
[b][/b][u][/u][i][/i][size=1][/size][color=#123123][/color]
Да ги премахва и да изпраща съобщението без тях
Код:
<?php
$comment=$_POST['comment'];
$comment = str_replace("[b]","<b>","$comment");
$comment = str_replace("[/b]","</b>","$comment");
$comment = str_replace("[code]","<textarea>","$comment");
$comment = str_replace("
","</textarea>","$comment");
$comment = str_replace("","<i>","$comment");
$comment = str_replace("
","</i>","$comment");
$comment = str_replace("","<font size='14'>","$comment");
$comment = str_replace("
","</font>","$comment");
$comment = str_replace("","<font color='#ffffff'>","$comment");
$comment = str_replace("
","</font>","$comment");
echo $comment;
?>[/code]
Надявам се, че схвана принципа..

Почти идеята ми е, че когато пращат съобщението в е-майл и използват bbcode там нз дали ще действа тези
Код:
"[b]","[/b]"
и за това искам да ги премахна
 
Ааааа ти въбще да ги махнеш, тогава така:
Код:
<?php
$comment=$_POST['comment'];
$comment = str_replace("[b]","","$comment");
$comment = str_replace("[/b]","","$comment");
$comment = str_replace("[code]","","$comment");
$comment = str_replace("
","","$comment");
$comment = str_replace("","","$comment");
$comment = str_replace("
","</i>","$comment");
$comment = str_replace("","","$comment");
$comment = str_replace("
","","$comment");
$comment = str_replace("","","$comment");
$comment = str_replace("
","","$comment");
echo $comment;
?>[/code]
 
DeathGuard_ каза:
Ааааа ти въбще да ги махнеш, тогава така:
Код:
<?php
$comment=$_POST['comment'];
$comment = str_replace("[b]","","$comment");
$comment = str_replace("[/b]","","$comment");
$comment = str_replace("[code]","","$comment");
$comment = str_replace("
","","$comment");
$comment = str_replace("","","$comment");
$comment = str_replace("
","</i>","$comment");
$comment = str_replace("","","$comment");
$comment = str_replace("
","","$comment");
$comment = str_replace("","","$comment");
$comment = str_replace("
","","$comment");
echo $comment;
?>[/code]

Друг начин няма ли защото имам над 50 цвята и 10 ресайза и трябва всичките да го пиша ...
 

Back
Горе