BBCode

Forum
Last Post
Threads / Messages

Fireballchad

Member
Member
Joined
Aug 28, 2009
Messages
49
Points
0
Age
32
Mysidian Dollar
4,928
Ok well I managed to get Bloodrun's forum to allow bbcode in post also.
PHP:
$a_answer=$_POST['a_answer'];
     // CONVERT ALL HTML SPECIAL CHARS TO THERE ENTITIES
        $a_answer = htmlentities($a_answer, ENT_QUOTES);
        
        // PARSE BB CODE
        $a_answer = preg_replace('|\[b\](.+?)\[\/b\]|i', '<strong>$1</strong>', $a_answer);
        $a_answer = preg_replace('|\[i\](.+?)\[\/i\]|i', '<em>$1</em>', $a_answer);
        $a_answer = preg_replace('|\[u\](.+?)\[\/u\]|i', '<u>$1</u>', $a_answer);
        $a_answer = preg_replace('|\[img\](.+?)\[\/img\]|i', '<img src=$1>', $a_answer);
        $a_answer = preg_replace('|\[url=(.+?)\](.+?)\[\/url\]|i', '<a href=$1>$2</a>', $a_answer);
        $a_answer = preg_replace('|\[color=(.+?[^;])\](.+?)\[\/color\]|i', '<span style="color:$1;">$2</span>', $a_answer);
        $a_answer = preg_replace('|\[size=(.+?[^;])\](.+?)\[\/size\]|i', '<span style="font-size:$1;">$2</span>', $a_answer);
        $a_answer = preg_replace('|\[left\](.+?)\[\/left\]|i', '<span style="text-align: left;">$1</span>', $a_answer);
        $a_answer = preg_replace('|\[right\](.+?)\[\/right\]|i', '<span style="text-align: right;">$1</span>', $a_answer);
        $a_answer = preg_replace('|\[center\](.+?)\[\/center\]|i', '<center>$1</center>', $a_answer);
        
$a_answer = mysql_real_escape_string($a_answer);
Thats how I managed to do it. First of all is it secure, secondly how do I make it change back to bbcode when you want to edit it? Right now it converts it to HTML and then when you go to edit your post or sig it is now HTML and not BBCode that you originally typed it in.
 
Well with the release of the next one, that problem is solved. The only thing it won't yet allow, is things like youtube videos.
 
Bloodrun said:
Well with the release of the next one, that problem is solved. The only thing it won't yet allow, is things like youtube videos.

Ah ok, still learning how to do this will benefit me in the future just in case you don't post a new update xD
 
Fireballchad said:
Bloodrun said:
Well with the release of the next one, that problem is solved. The only thing it won't yet allow, is things like youtube videos.

Ah ok, still learning how to do this will benefit me in the future just in case you don't post a new update xD

Yes it will help you =D

And by the looks of it, that update won't be anytime soon =/
 
Bloodrun said:
Fireballchad said:
Bloodrun said:
Well with the release of the next one, that problem is solved. The only thing it won't yet allow, is things like youtube videos.

Ah ok, still learning how to do this will benefit me in the future just in case you don't post a new update xD

Yes it will help you =D

And by the looks of it, that update won't be anytime soon =/

ya since you dont have a computer and such? Anyways i've been caught up in school stuff, so my updates to my site are getting harder to do also :(
 
Fireballchad said:
Bloodrun said:
Fireballchad said:
Bloodrun said:
Well with the release of the next one, that problem is solved. The only thing it won't yet allow, is things like youtube videos.

Ah ok, still learning how to do this will benefit me in the future just in case you don't post a new update xD

Yes it will help you =D

And by the looks of it, that update won't be anytime soon =/

ya since you dont have a computer and such? Anyways i've been caught up in school stuff, so my updates to my site are getting harder to do also :(

I have a computer, just not a conssistant amount of internet access.
Im hoping that will all change within the next two months >.<
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,267
Messages
33,049
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top