Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts

    Including bb coding

    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 Code:
    <?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]""<center>"$txt);
    $txt str_replace("[/center]""</center>"$txt);
    $txt str_replace("[b]""<b>"$txt);
    $txt str_replace("[/b]""</b>"$txt);
    $txt str_replace("[i]""<i>"$txt);
    $txt str_replace("[/i]""</i>"$txt);
    $txt str_replace("[u]""<u>"$txt);
    $txt str_replace("[/u]""</u>"$txt);
    $txt str_replace("[marquee]""<marquee>"$txt);
    $txt str_replace("[/marquee]""</marquee>"$txt);
    $txt str_replace("[url]""<a href=leave.php?site=$txt"$txt);
    $txt str_replace("[*url]"">"$txt);
    $txt str_replace("[/url]""</a>"$txt);
    $txt str_replace("[quote]""<table width='99%'><tr><td class='quotedMessage' colspan='1'><b>QUOTE:</b><br>"$txt);
    $txt str_replace("[/quote]""</td></tr></table>"$txt);
    $txt str_replace("[code]""<div id=code>"$txt);
    $txt str_replace("[/code]""</div>"$txt);
    $txt str_replace(array("\r\n""\n""\r"), '<br>'$txt); 
    $txt str_replace("[b]""<b>"$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("[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("[color=green]""<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("[/color]""</font>"$txt);

    $txt str_replace("[colour=green]""<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("[/colour]""</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]""</size>"$txt);


    $bb = array(

    "[user='",

    "']",

    "[/user]",

    "[crew='",

    "']",

    "[/crew]");



    $html = array(

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

    '">',

    '</a>',

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

    '">',

    '</a>');



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

    $bb2 = array(

    "[img]",

    "[/img]");




    $html2 = array(

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

    '">',

    '</a>');




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


    $txt str_replace("[img]""<img border=0 src="$txt);
    $txt str_replace("[/img]""></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(''',"'",$txt);
    $txt str_replace('&#amp;','&',$txt);
    return 
    $txt;
    }
    ?>
    any help i will be greatful for.

    Cheers.

    Dan13071992
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #2
    Regular Coder
    Join Date
    Jul 2010
    Location
    Oregon City
    Posts
    280
    Thanks
    5
    Thanked 50 Times in 49 Posts
    from the looks of it you aren't calling the functions anywhere?

  • #3
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    well i have an inc-functions.php which is also included in every page, how can i have it automatically call it?
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #4
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,341
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    You realise your signature has two http://'s in it right?
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #5
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    Quote Originally Posted by tangoforce View Post
    You realise your signature has two http://'s in it right?
    thanks
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #6
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    can anyone please help me?
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by Dan13071992 View Post
    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.

  • #8
    Regular Coder
    Join Date
    Dec 2010
    Location
    Kent, UK
    Posts
    573
    Thanks
    23
    Thanked 10 Times in 10 Posts
    I got it working, i used
    PHP Code:
    ".replace($fetch->quote)." 
    that being a function that was being used in smile.php.

    thank you for your help guys.
    http://360-tactics.co.uk/forum/index.php

    Crime-Wave

    please post your code wrapped in tags
    please post your PHP wrapped in tags


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •