[php] bbcode

Started on the old forum in March 2011 · view the original in the archive · old links redirect here

6 replies · 880 views · started 15 years ago · 1 min read

4 participants
milomir Developer · 94 posts #2
$string = preg_replace('#\[php\](.*?)\[\/php\]#se', "'<div>' . highlight_string(stripslashes('$1'), true) . '</div>'", $string);

where $string is your input string (forum post for example)..

subzero Super moderator Fellow · 3,954 posts #5

\1

$string = preg_replace('#\[php\](.*?)\[\/php\]#se', "'<div>' . highlight_string(stripslashes('\\1'), true) . '</div>'", $string); 

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

something else Fellow · 2,296 posts #7

i dont know where my post went to in this topic lol $1 is the same as \1 just depends on what php editor you use also the " " at the start and end of the replacement need removing eg:

$string = preg_replace('#\[php\](.*?)\[\/php\]#se', '<div>' . highlight_string(stripslashes('$1'), true) . '</div>', $string);

//some text here to get rid of opera bug and this forum :/

you may also need to do string replacements on to "" and htmlspecialchars_decode() if you have already used htmlspecialchars()

adex3g wrote: $super="something else"; echo "thank you $super"; Added after 2 minutes: What can i use to prevent my post so not to hack by hacker with this bbcode

Providing it is used properly then any html inserted into the [ php] tags should not get executed by the browser 🙂

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close