...

View Full Version : Including bb coding



Dan13071992
11-13-2011, 07:53 PM
below is my entire smile.php file, it is my bb coding which is included into every page, the problem im having is getting the text on the page to change according to what is in this smile.php page.



<?php
function replace($txt) {

$txt = str_replace(":)", "<img src=\"Smiles/smile.gif\">", $txt);
$txt = str_replace(":(", "<img src=\"Smiles/sad.gif\">", $txt);
$txt = str_replace(":o", "<img src=\"Smiles/suprised.gif\">", $txt);
$txt = str_replace(":O", "<img src=\"Smiles/suprised.gif\">", $txt);
$txt = str_replace(":p", "<img src=\"Smiles/tounge.gif\">", $txt);
$txt = str_replace(":P", "<img src=\"Smiles/tounge.gif\">", $txt);
$txt = str_replace(":'(", "<img src=\"Smiles/cry.gif\">", $txt);
$txt = str_replace("8|", "<img src=\"Smiles/eek.gif\">", $txt);
$txt = str_replace("o.o", "<img src=\"Smiles/eek.gif\">", $txt);
$txt = str_replace("O.O", "<img src=\"Smiles/eek.gif\">", $txt);
$txt = str_replace(":...:", "<img src=\"Smiles/dotdotdot.gif\">", $txt);
$txt = str_replace(":.", "<img src=\"Smiles/stare.gif\">", $txt);
$txt = str_replace(":D", "<img src=\"Smiles/biggrin.gif\">", $txt);
$txt = str_replace(":s", "<img src=\"Smiles/confused.gif\">", $txt);
$txt = str_replace(":S", "<img src=\"Smiles/confused.gif\">", $txt);
$txt = str_replace("8)", "<img src=\"Smiles/cool.gif\">", $txt);




/////////Racist Block's////////////

$txt = str_replace("Black Basterd", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("black basterd", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("BLACK BASTERD", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("Black BASTERD", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("BLACK basterd", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("Black ****", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("BLACK ****", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("Black ****", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("BLACK ****", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("black ****", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("Paki", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("Packi", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("PAKI", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("PaKi", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("paki", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("PaKi", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("pAkI", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("******", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("******", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("******", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("******", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("Nigga", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("NiGGa", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("NIGGA", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);
$txt = str_replace("nigga", "<font color=darkred><b><a href=racist.php>Violation</a></b></font>", $txt);



///////////Websites///////////
$txt = str_replace("gangparadise", "Site", $txt);
$txt = str_replace("xtreme-mafia", "Site", $txt);
$txt = str_replace("trumobsters", "Site", $txt);
$txt = str_replace("urban-mafia", "Site", $txt);
$txt = str_replace("gangstermafia", "Site", $txt);
$txt = str_replace("Bootleggers", "Site", $txt);
$txt = str_replace("bootleggers", "Site", $txt);




/////////BB Codes////////////



$txt = str_replace("
", "<center>", $txt);
$txt = str_replace("", "</center>", $txt);
$txt = str_replace("", "<b>", $txt);
$txt = str_replace("", "</b>", $txt);
$txt = str_replace("", "<i>", $txt);
$txt = str_replace("", "</i>", $txt);
$txt = str_replace("", "<u>", $txt);
$txt = str_replace("", "</u>", $txt);
$txt = str_replace("", "<marquee>", $txt);
$txt = str_replace("", "</marquee>", $txt);
$txt = str_replace("", "<a href=leave.php?site=$txt", $txt);
$txt = str_replace("[*url]", ">", $txt);
$txt = str_replace("", "</a>", $txt);
$txt = str_replace("
", "<table width='99%'><tr><td class='quotedMessage' colspan='1'><b>QUOTE:</b><br>", $txt);
$txt = str_replace("", "</td></tr></table>", $txt);
$txt = str_replace("
", "<div id=code>", $txt);
$txt = str_replace("", "</div>", $txt);
$txt = str_replace(array("\r\n", "\n", "\r"), '<br>', $txt);
$txt = str_replace("[b]", "<b>", $txt);
$txt = str_replace("", "<size=1>", $txt);
$txt = str_replace("[size=2]", "<size=2>", $txt);
$txt = str_replace("[size=3]", "<size=3>", $txt);
$txt = str_replace("[size=3]", "<size=3>", $txt);
$txt = str_replace("[size=4]", "<size=4>", $txt);
$txt = str_replace("[size=5]", "<size=5>", $txt);
$txt = str_replace("[567382]", "$_SESSION[username]", $txt);
$txt = str_replace("[green]", "<font color=GREEN>", $txt);
$txt = str_replace("[red]", "<font color=RED>", $txt);
$txt = str_replace("[blue]", "<font color=BLUE>", $txt);
$txt = str_replace("[purple]", "<font color=PURPLE>", $txt);
$txt = str_replace("[yellow]", "<font color=YELLOW>", $txt);
$txt = str_replace("[gold]", "<font color=GOLD>", $txt);
$txt = str_replace("[black]", "<font color=BLACK>", $txt);
$txt = str_replace("[hr]", "<hr>", $txt);
$txt = str_replace("", "<font color=GREEN>", $txt);
$txt = str_replace("[color=red]", "<font color=RED>", $txt);
$txt = str_replace("[color=blue]", "<font color=BLUE>", $txt);
$txt = str_replace("[color=purple]", "<font color=PURPLE>", $txt);
$txt = str_replace("[color=orange]", "<font color=orange>", $txt);
$txt = str_replace("[color=white]", "<font color=white>", $txt);
$txt = str_replace("[color=yellow]", "<font color=YELLOW>", $txt);
$txt = str_replace("[color=gold]", "<font color=GOLD>", $txt);
$txt = str_replace("[color=black]", "<font color=BLACK>", $txt);
$txt = str_replace("[color=gray]", "<font color=GRAY>", $txt);
$txt = str_replace("[color=grey]", "<font color=GREY>", $txt);
$txt = str_replace("", "</font>", $txt);

$txt = str_replace("", "<font color=GREEN>", $txt);
$txt = str_replace("[colour=red]", "<font color=RED>", $txt);
$txt = str_replace("[colour=blue]", "<font color=BLUE>", $txt);
$txt = str_replace("[colour=purple]", "<font color=PURPLE>", $txt);
$txt = str_replace("[colour=orange]", "<font color=orange>", $txt);
$txt = str_replace("[colour=white]", "<font color=white>", $txt);
$txt = str_replace("[colour=yellow]", "<font color=YELLOW>", $txt);
$txt = str_replace("[colour=gold]", "<font color=GOLD>", $txt);
$txt = str_replace("[colour=black]", "<font color=BLACK>", $txt);
$txt = str_replace("[colour=gray]", "<font color=GRAY>", $txt);
$txt = str_replace("[colour=grey]", "<font color=GREY>", $txt);
$txt = str_replace("", "</font>", $txt);
$txt = str_replace("[viewing]", "$_SESSION[username]", $txt);


$txt = str_replace("[size=1]", "<size=1>", $txt);
$txt = str_replace("[size=2]", "<size=2>", $txt);
$txt = str_replace("[size=3]", "<size=3>", $txt);
$txt = str_replace("[size=3]", "<size=3>", $txt);
$txt = str_replace("[size=4]", "<size=4>", $txt);
$txt = str_replace("[size=5]", "<size=5>", $txt);
$txt = str_replace("", "</size>", $txt);


$bb = array(

"",

"",

"",

"");



$html = array(

'<a href="profile.php?viewuser=',

'">',

'</a>',

'<a href="crewprofile.php?viewcrew=',

'">',

'</a>');



$txt = stripslashes(str_replace($bb, $html, $txt));

$bb2 = array(

"",

"");




$html2 = array(

'<a target="_blank" href="$txt',

'">',

'</a>');




$txt = stripslashes(str_replace($bb2, $html2, $txt));


$txt = str_replace("", "<img border=0 src=", $txt);
$txt = str_replace("", "></a>", $txt);


return $txt;
}

function rep2($txt) {
$txt = str_replace('&lt;','<',$txt);
$txt = str_replace('&gt;','>',$txt);
$txt = str_replace('&quot;','"',$txt);
$txt = str_replace('&#039;',"'",$txt);
$txt = str_replace('&#amp;','&',$txt);
return $txt;
}
?>


any help i will be greatful for.

Cheers.

Dan13071992

Adee
11-13-2011, 08:09 PM
from the looks of it you aren't calling the functions anywhere?

Dan13071992
11-13-2011, 08:12 PM
well i have an inc-functions.php which is also included in every page, how can i have it automatically call it?

tangoforce
11-13-2011, 09:15 PM
You realise your signature has two http://'s in it right?

Dan13071992
11-13-2011, 09:29 PM
You realise your signature has two http://'s in it right?

thanks :thumbsup:

Dan13071992
11-15-2011, 06:56 PM
can anyone please help me?

Fou-Lu
11-15-2011, 11:05 PM
well i have an inc-functions.php which is also included in every page, how can i have it automatically call it?

You don't want to automatically call. If you do, it will replace any occurrence even when that behaviour is not desired. You need to specify what to show (like a blog post for example) and wrap that within your calling functions.

To automatically call though, you would do two things. The first is to enable the output buffer with ob_start. Then, either use the ob_start method handling or write a register_shutdown_function to sweep up the contents in the buffer and pull the replacement. That affects all output though, which is why its not advisable.

Dan13071992
11-16-2011, 12:35 PM
I got it working, i used


".replace($fetch->quote)."


that being a function that was being used in smile.php.

thank you for your help guys.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum