Hi, this is the news page for my site, i tried including my bbcode file too but it doesnt seem to be replacing the bbcode tags

News Frontend:
PHP Code:
<?
include '../includes/functions.php';
include 
'../includes/replace.php';
logincheck();
$info=mysql_fetch_object(mysql_query("SELECT rank,money,crew FROM users WHERE username='$username'"));


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="../stylesheets/online.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body,td,th {
    color: #FFFFFF;
}
body {
    background-color: #4f4f4f;
}
-->
</style></head>
<?

$view
=$_GET['viewuser'];

$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$view'"));
$refs=mysql_num_rows(mysql_query("SELECT username FROM users WHERE referal='$fetch->username'"));
$crew=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew'"));
if(
$_POST['bad']){
echo 
"<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=help.php?type=Complaint&text=Bad Profile For Username - $viewuser . 

Reason For Report: \">"
;
}
$rows=mysql_num_rows(mysql_query("SELECT * FROM users WHERE username='$view'"));
if(
$rows == "0"){
print 
"User not found !";
exit();
}

if(
$fetch->crew == "0"){
$crew="None";
}else{
$crew=$fetch->crew;
}

$users_image=$fetch->image;
$quote=$fetch->quote;

$reg=$fetch->regged;
$time=time();
$sum=$time-$reg;
if(
$sum 86400){
$days=1;
}else{
$days=round(($sum)/(86400));
}

if(
$fetch->money "500000"){
$wel="Lower Class";
}elseif(
$fetch->money "5000000"){
$wel="Middle Class";
}elseif(
$fetch->money >= "5000000"){
$wel="Upper Class";
}

?>

<body>
<table width="70%" height="438" border="0" cellspacing="0" align="center" class="background">
  <tr class="header">
    <td colspan="2">Profile for <? print"$view"?></td>
  </tr>
  <tr>
    <td colspan="2" class="background"><div align="center"><img src="<? print"$users_image"?>" alt="Users Image" name="image" width="" height="" id="image" /></div></td>
  </tr>
  <tr>
    <td width="167" height="20" class="background"><strong>Username</strong></td>
    <td width="232" class="background"><a href='send.php?fromper=<? print"$fetch->username"?>'><? print"$fetch->username"?></a></td>
  </tr>
  <tr>
    <td class="background"><strong>Status</strong></td>
    <td class="background"><? print"$fetch->status"?></td>
  </tr>
  <tr>
    <td class="background"><strong>Social Class</strong></td>
    <td class="background"><? print"$wel"?></td>
  </tr>  
  <tr>
    <td class="background"><strong>Crew</strong></td>
 <? 
 
if($crew == "None"){?>
    <td class="background"><? print"$crew";?></td>
<? }else{
 
$crew=mysql_fetch_object(mysql_query("SELECT * FROM crews WHERE name='$crew'")); ?>
     <td class="background"><? print"<a href='crewprofile.php?crewid=$crew->id'>$crew->name</a>";?></td>
<? ?>
  </tr>
  <tr>
    <td class="background"><strong>Rank</strong></td>
    <td class="background"><? print"$fetch->rank"?></td>
  </tr>
  <tr>
    <td class="background"><strong>Days Playing </strong></td>
    <td class="background"><? print "".makecomma($days).""?></td>
  </tr>
  <tr>
    <td class="background"><strong>Referals</strong></td>
    <td class="background"><? print "".makecomma($refs).""?></td>
  </tr>
  <tr>
    <td colspan="2" class="header">Quote  
    <? if($username == $view){ 
    print
"<a href='edit_profile.php'> - Edit Your Profile</a>"
    } 
?>    </td>
  </tr>
  <tr>
    <td colspan="2" class="background"><? print"".replace($quote).""?></td>
  </tr>
</table>

<p>&nbsp;</p>
<form id="form1" name="form1" method="post" action="">
  <div align="center">
    <input name="bad" type="submit" class="button" id="bad" value="Repord Bad Profile Content" />
  </div>
</form>
<p>
  <? if ($info->rank == 'Civilian'){ ?>
</p>
<table width="386" border="0" align="center" cellspacing="0" class="help">
  <tr>
    <th width="49" scope="col"><a href="help.php?type=Complaint"><img src="../images/question mark.jpg" alt="Click To Contact Staff For Help" name="help" width="49" height="46" border="0"></a></th>
    <th width="333" scope="col"><div align="left">
This is the profile page! Here you can see the information of the player you choose to look at and the picture, music and information they input themselves! The information is up to date to the time you click on it!. If you think a profile takes too long to load (depending on your connection) or shows abusive material please contact an admin / mod straight away! 
      </div></th>
  </tr>
</table></body>
<? ?>
</html>
<? include_once 'footer.php'?>
BBCODE PHP
PHP Code:
<?php

function replace($txt) {
$txt str_replace("[color=" "<font color="$txt);
$txt str_replace("[/color]" "</font>"$txt);

$txt str_replace("[img]a","Don't Bother...."$txt);
$txt str_replace("javascript","Don't Bother...."$txt);
$txt str_replace("alert""Don't Bother...."$txt);


$txt str_replace("a:""Don't Bother...."$txt);
$txt str_replace("A:""Don't Bother...."$txt);
$txt str_replace("javascript:%20alert""Don't Bother...."$txt);




$txt str_replace(":)" "<img border=0 src=../emotions/smile.gif>" $txt);
$txt str_replace(":(" "<img border=0 src=../emotions/sad.gif>" $txt);
$txt str_replace(";)" "<img border=0 src=../emotions/wink.gif>" $txt);
$txt str_replace(":o" "<img border=0 src=../emotions/omg.gif>" $txt);
$txt str_replace(":O" "<img border=0 src=../emotions/omg.gif>" $txt);
$txt str_replace(":D" "<img border=0 src=../emotions/big.gif>" $txt);
$txt str_replace(":d" "<img border=0 src=../emotions/big.gif>" $txt);
$txt str_replace(":box:" "<img border=0 src=../emotions/box.gif>" $txt);
$txt str_replace(":@" "<img border=0 src=../emotions/mad.gif>" $txt);
$txt str_replace(":no:" "<img border=0 src=../emotions/nono.gif>" $txt);
$txt str_replace(":s" "<img border=0 src=../emotions/question.gif>" $txt);
$txt str_replace(":S" "<img border=0 src=../emotions/question.gif>" $txt);
$txt str_replace(":ill:" "<img border=0 src=../emotions/pukeface.gif>" $txt);
$txt str_replace(":weed:" "<img border=0 src=../emotions/weed.gif>" $txt);

$txt str_replace("[c]""<center>"$txt);
$txt str_replace("[/c]""</center>"$txt);
$txt str_replace("[C]""<center>"$txt);
$txt str_replace("[/C]""</center>"$txt);
$txt str_replace("[r]""<div align='right'>"$txt);
$txt str_replace("[/r]""</div>"$txt);
$txt str_replace("[/R]""</div>"$txt);
$txt str_replace("[R]""<div align='right'>"$txt);
$txt str_replace("[l]""<div align='left'>"$txt);
$txt str_replace("[/l]""</div>"$txt);
$txt str_replace("[L]""<div align='left'>"$txt);
$txt str_replace("[/L]""</div>"$txt);
$txt str_replace("[b]""<b>"$txt);
$txt str_replace("[/b]""</b>"$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("[I]""<i>"$txt);
$txt str_replace("[/I]""</i>"$txt);
$txt str_replace("[u]""<u>"$txt);
$txt str_replace("[/u]""</u>"$txt);
$txt str_replace("[U]""<u>"$txt);
$txt str_replace("[/U]""</u>"$txt);
$txt str_replace("[move]""<marquee>"$txt);
$txt str_replace("[/move]""</marquee>"$txt);
$txt str_replace("[MOVE]""<marquee>"$txt);
$txt str_replace("[/MOVE]""</marquee>"$txt);
$txt str_replace("[url]""<a target='newframe' href="$txt);
$txt str_replace("[*url]"">"$txt);
$txt str_replace("[/url]""</a>"$txt);
$txt str_replace("[URL]""<a target='newframe' href="$txt);
$txt str_replace("[*URL]"">"$txt);
$txt str_replace("[/URL]""</a>"$txt);
$txt str_replace("[img]""<img border=0 src="$txt);
$txt str_replace("[/img]"">"$txt);
$txt str_replace("[IMG]""<img border=0 src="$txt);
$txt str_replace("[/IMG]"">"$txt);
$txt str_replace("[quote]""<div id=quote><b>QUOTE:</b><br>"$txt);
$txt str_replace("[/quote]""</div>"$txt);
$txt str_replace("[rule]""<hr>"$txt);
$txt str_replace("[RULE]""<hr>"$txt);

$txt str_replace(array("\r\n""\n""\r"), '<br>'$txt); 
$txtpy 0;
while (
$txtpy 9){
$txt str_replace("$filter[$txtpy]""Don't Bother...."$txt);
$txtpy++;
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;
}
?>
if anyone could help it would be very much apreciated!