bbcodes

Started on the old forum in November 2010 · view the original in the archive · old links redirect here

#bbcode #extra #lavalair #pmbguy

10 replies · 2,031 views · started 16 years ago · 1 min read

5 participants
pmbguy Senior · 344 posts #1

ok, i figured i'd post a list of bbcodes i put together...

//////////////////////url bbcode safer////////////////////////////////
$text = preg_replace("/\[url\=(.*?)\](.*?)\[\/url\]/is","<a href=\"urlredir.php?redir=$1&who=$user\">$2</a>",$text);
(safe links... i'll upload urlredir.php as attachment)
//////////////////align codes//////////////////////
$text=preg_replace("/\[left\](.*?)\[\/left\]/i","<p align=\"left\">\\1</p>", $text);

  $text=preg_replace("/\[center\](.*?)\[\/center\]/i","<p align=\"center\">\\1</p>", $text);

  $text=preg_replace("/\[right\](.*?)\[\/right\]/i","<p align=\"right\">\\1</p>", $text);

 $text = preg_replace("/\[div\=(.*?)\](.*?)\[\/div\]/i","<div align=\"$1\">$2</div>",$text);
/////////////////////////////////quote/code bbcode/////////////////////////////
$text = preg_replace("/\[code\](.+?)\[\/code\]/is","<div align=\"left\"><BLOCKQUOTE><b>Code:</b><br/><i>\\1<i/></BLOCKQUOTE></div>", $text);

  $text = preg_replace("/\[quote\](.+?)\[\/quote\]/is","<div align=\"left\"><BLOCKQUOTE><b>Quote:<br/></b>\\1</BLOCKQUOTE></div>", $text);
//////////////////////////////search engine bbcodes/////////////////////////////
$text = preg_replace("/\[ufym\=(.*?)\](.*?)\[\/ufym\]/is","<a href=\"http://ufym.net/search.asp?q=$1&s=ufym&sbmt=Search\">ufym:$2</a>",$text);

   $text = preg_replace("/\[google\=(.*?)\](.*?)\[\/google\]/is","<a href=\"http://www.google.com/search?q=$1\">Google:$2</a>",$text);

$text = preg_replace("/\[gimg\=(.*?)\](.*?)\[\/gimg\]/is","<a href=\"http://www.google.com/m/search?sa=2&q=$1&site=images\">G-IMG:$2</a>",$text);

 $text = preg_replace("/\[vuclip\=(.*?)\](.*?)\[\/vuclip\]/is","<a href=\"http://vuclip.com/s?sn=1&z=1002&k=$1&output=video\">VidSearch:$2</a>",$text);

$text = preg_replace("/\[h2g2\=(.*?)\](.*?)\[\/h2g2\]/i","<a href=\"http://www.bbc.co.uk/dna/h2g2/pda/search?searchtype=article&searchstring=$1&showapproved=1&show=12\">h2g2:$2</a>",$text);

       $text = preg_replace("/\[news\=(.*?)\](.*?)\[\/news\]/i","<a href=\"http://news.google.com/news/search?q=$1\">news:$2</a>",$text);

   $text = preg_replace("/\[define\=(.*?)\](.*?)\[\/define\]/i","<a href=\"http://lookwayup.com/lwu.exe/lwu/d?s=s&w=$1\">define:$2</a>",$text);

  $text = preg_replace("/\[rhyme\=(.*?)\](.*?)\[\/rhyme\]/i","<a href=\"http://www.rhymezone.com/r/rhyme.cgi?Word=$1&typeofrhyme=perfect&org1=syl&org2=l\">rhymez4:$2</a>",$text);
//////////////////////////////@linking (twitter style)////////////////////////////////
 if(substr_count($text,"@")<=5)
    {
    $text=preg_replace("/\@(.*?)\@/i","<font color=\"lime\"><b>@</b></font><a href=\"index.php?action=viewuser&user=\\1&sid=$sid\">\\1</a><font color=\"lime\"><b>@</b></font> ", $text);
    }
///////////////extra code to post inbox when mentoined///////////////////////////
 if(substr_count($text,"@")<=5)
    {
   $text=preg_replace("/\@(.*?)\ /i","@<a href=extraz.php?action=statusbar&user=$1&sid=$sid>$1</a>", $text);
(modify to view user)
  $number = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM fun_users WHERE name='$1'"));
 if ($number[0]>=1)
          {
         $mem = mysql_fetch_array(mysql_query("SELECT id FROM fun_users WHERE name='$1'"));
        $msg = "@$user mentioned you in a status update...";
        autopm($msg, $mem[0]);
    }
    }
Vayne Developer · 106 posts #7

yeah sure, allow align`s to use. after someone uses that, check out page in html validator. 🙂

Nous Ne Dansos Pas, Nous Sommes Le Danse.!

wapxtech Developer · 189 posts #8

if you will allow linking in bbcode it will add the risk for xss attack.. you can use str_replace to prevent it.. and replace the string php they are linking php script in their xss to steal sessions..

External image (may be gone) http://wapx.amob.com Applications, Games, Wallpapers, Ringtones, Videos, Themes, Screensaver and More!!!

CreativityKills Lead · 833 posts #9

XSS can do waay mur than steal sessions. But if ur so caught up with the stealing cookie ****, i cud load a .js page with xss and stil steal ur cookie. Hell i cud load a .py or .ror file and steal ur ****. But if im to carry out an annoying attack on ur site i'd usually just try to piss ur users off by redirecting them to my page.

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