Jump to content

Chat code headache


sjg301

Recommended Posts

Okay i thank you all for the help in my last problem with this code i know almost have chat up and running ecept when text is entered and say is clicked the persons name who psted show's but not there text again here's the code any of you point me into the right direction btw i also have the same problome with my mb threads and what not show however when a topic is created again the posters name shows and nothing else(i can manually make mb psot's appear in the mbdb)

 

 

<?
session_start();


if ($box == 1){
        include ("gameconfig.php");

        $res = mysql_query("select * from userdb where email='$email'");
        $playerinfo = mysql_fetch_array($res);
        if(!$email || !$password){
                error("field");
                exit;
        }

        if($playerinfo[password] != $password){
                error("password");
                exit;
        }
}else{

        include ("gameconfig.php");
        $title = "Chat";

        if(!$email || !$password){
                error("field");
                exit;
        }

        if($playerinfo[password] != $password){
                error("password");
                exit;
        }
}

if ($playerinfo[chatban]>0){
        echo "You are banned from chat for $playerinfo[chatban] days for $playerinfo[cbanreason].";
        exit;
}

if($playerinfo[jailtime] > 0){
    jailerror("jail", $email);
    exit;
}


$staff = "0";
$private = "0";
if ($playerinfo[status] == "Manager"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=yellow>$playerinfo[username]</font></a></font>";
}elseif ($playerinfo[status] == "VManager"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#FF8000>$playerinfo[username]</font></a></font>";
//}elseif ($playerinfo[job] == "Helper"){
//        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=red>$playerinfo[username]</font></a></font>";
}elseif ($playerinfo[status] == "Operator"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#800080>$playerinfo[username]</font></a></font>";
}elseif ($playerinfo[status] == "admin"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#2FE800>$playerinfo[username]</font></a></font>";
}elseif ($playerinfo[status] == "Editor"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#32D3CB>$playerinfo[username]</font></a></font>";
}elseif ($playerinfo[status] == "Chat Monitor"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#993333>$playerinfo[username]</font></a>";
}elseif ($playerinfo[status] == "Trainee"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#C47D7D>$playerinfo[username]</font></a>";
}elseif ($playerinfo[job] == "E-Paper Editor"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#1874CD>$playerinfo[username]</font></a>";
}elseif ($playerinfo[job] == "EPaper") {
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#1874CD>$playerinfo[username]</font></a>";
}else{
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent>$playerinfo[username]</a>";
}

if ($box==1){
        if ($text){
                if (strlen($text)<101 && !ereg("^/",$text)){
                        $dscript_act = "encode";
            $enter = $text;
            include ("dstml.php");
            $repl5 = "$repl5</b></em></i></u></strike></b></i></u></strike></font></b></em></i></u></strike></b></i></u></strike></font>";
            $repl5 = str_replace("`nam`", "$playerinfo[username]", $repl5);
            $repl5 = str_replace("fuck", "f*ck", $repl5);
            $repl5 = str_replace("Fuck", "F*ck", $repl5);
$betval = rand(1, 6);
if($betval = 6){
//$repl5 = str_replace(".com", ",", $repl5);
//$repl5 = str_replace(". com", ",", $repl5);
}elseif($betval = 5){
//$repl5 = str_replace(".com", "", $repl5);
//$repl5 = str_replace(". com", "", $repl5);
}elseif($betval = 4){
//$repl5 = str_replace(".com", "com", $repl5);
//$repl5 = str_replace(". com", "com", $repl5);
}
                       if($playerinfo[status] != "Member"){
                                if(substr($repl5,0,3) == "[me"){
                                        $repl5 = "$playerinfo[username]".substr($repl5,3);
                                        $username = '';
                                }
                        }else{
                                if(substr($repl5,0,3) == "[me"){
                                        $repl5 = "~ $playerinfo[username]".substr($repl5,3);
                                        $username = '';
                                }
                        }

            if ($playerinfo[chatdefcol] != "#FF0000"){
                              //  $then = mysql_query("insert into chat_lines (id, userid, username, message, staff, private) values ('', '$playerinfo[id]', '$username', '<font color=$playerinfo[chatdefcol]>$repl5', '0', '0')"); //added ) 
                                $setlines = mysql_query("update userdb set chatlines=chatlines+1 where id='$playerinfo[id]'");
                        }else{
                              // [b][font color=#FF0000]$then = mysql_query ("insert into chat_lines (id, userid, username, message, staff, private) values ('', '$playerinfo[id]', '$username', '$repl5', '0', '0')");[/font][/b]
                                $setlines = mysql_query("update userdb set chatlines=chatlines+1 where id='$playerinfo[id]'");
            }

                        $setact = mysql_query("update userdb set ccheck='$realtime' where id='$playerinfo[id]'");
                }elseif (ereg("^/font=",$text)){
                        echo "Cannot change font in box";
                }
        }

       // $chatpull = mysql_query("SELECT * FROM chat_lines ORDER BY id DESC, id ASC limit 0,4");
        echo "<BODY TOPMARGIN=\"0\" LEFTMARGIN=\"0\" RIGHTMARGIN=\"0\" BOTTOMMARGIN=\"0\">";
        while ($display=mysql_fetch_array($chatpull)){
     $display[message] = str_replace("`namey`", "$playerinfo[username]", $display[message]);
//  ################################################################
/*                if($display[staff] == "1" && $playerinfo[status] == "Member"){
                        echo "";
                }else{
                        echo "$display[username]> $display[message]</font></u></i></b><br>";
                } */
//   ################################################################
                if(!$display[username]){
                        if($display[staff] == "1" && $playerinfo[status] == "Member"){
                                echo "";
                        }else{
                                if($display['private'] > 0){
                                        if($display['private'] == "$playerinfo[id]"){
                                                //echo "$display[message</b></em></i></u></strike></b></i></u></strike></font>]</font></u></i></b></span><br>";
                                        }else{
                                                echo "";
                                        }
                                }else{
                                        echo "$display[message]</font></u></i></b></b></em></i></u></strike></b></i></u></strike></font></span><br>";
                                }
                        }
                }else{
                        echo "$display[username]> $display[message]</font></u></b></em></i></u></strike></b></i></u></strike></font></i></b></span><br>";
                }


        }
}elseif (!$action && !$box){
        include ("top.php");
        if ($playerinfo[status]!="Member" /*&& $playerinfo[status]!="Editor"*/){
         echo "<a href=chat.php?action=monitor>Chat monitor options</a> | <a href=chat.php?action=monitor&step=dlog>Download log</a> | <a href=chat.php?action=monitor&step=viewall>View all messages</a> | <a href=chat.php?action=monitor&step=clearcon>Clear chat</a><p>";
        }

        $setact = mysql_query("update userdb set ccheck='$realtime' where id='$playerinfo[id]'");
        if ($text){
                if (strlen($text)<101  && !ereg("^/",$text)){
                                $dscript_act = "encode";
                                $enter = $text;
                
                $repl5 = "$repl5</b></i></u></strike></b></i></u></strike></b></em></i></u></strike></b></i></u></strike></font></font>";
            $repl5 = str_replace("`nam`", "$playerinfo[username]", $repl5);
           
$betval = rand(1, 6);
if($betval = 6){
//$repl5 = str_replace(".com", ",", $repl5);
//$repl5 = str_replace(". com", "", $repl5);
}elseif($betval = 5){
//$repl5 = str_replace(".com", "", $repl5);
//$repl5 = str_replace(". com", "", $repl5);
}elseif($betval = 4){
//$repl5 = str_replace(".com", "com", $repl5);
//$repl5 = str_replace(". com", "com", $repl5);
}
                                if($playerinfo[status] != "Member"){
                                        if(substr($repl5,0,4) == "[msg"){
                                                $repl5 = substr($repl5,5);
                                                $username = '<font color=white><b>Staff Announcement:</b></font>';
                                        }
                                        if(substr($repl5,0,6) == "[staff"){

if ($playerinfo[status] == "Manager"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=yellow>$playerinfo[username]</font></a></font>";
$cheese='yellow';
}elseif ($playerinfo[status] == "VManager"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#FF8000>$playerinfo[username]</font></a></font>";
$cheese='#FF8000';

}elseif ($playerinfo[status] == "Operator"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#800080>$playerinfo[username]</font></a></font>";
$cheese='#800080';

}elseif ($playerinfo[status] == "admin"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#2FE800>$playerinfo[username]</font></a></font>";
$cheese='#2FE800';

}elseif ($playerinfo[status] == "Editor"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#32D3CB>$playerinfo[username]</font></a></font>";
$cheese='#32D3CB';

}elseif ($playerinfo[status] == "Chat Monitor"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#993333>$playerinfo[username]</font></a>";
$cheese='#993333';

}elseif ($playerinfo[status] == "Trainee"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#C47D7D>$playerinfo[username]</font></a>";
$cheese='#C47D7D';
}elseif ($playerinfo[job] == "E-Paper Editor"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#1874CD>$playerinfo[username]</font></a>";
$cheese='#1874CD';
}elseif ($playerinfo[job] == "E-Paper"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#1874CD>$playerinfo[username]</font></a>";
$cheese='#1874CD';
}


                                                $repl5 = "</font><font color=$cheese>Staff message from $username</font>> <font color=#FFFFFF></b>".substr($repl5,7)."</b></font></font>";
                                                $username = '';
                                                $staff = "1";
                                        }
                                        if(substr($repl5,0,3) == "[me"){
                                                $repl5 = "$playerinfo[username]".substr($repl5,3);
                                                $username = '';
                                        }
                                        if(substr($repl5,0,1) == "["){
                                                $userx = strpos($repl5, " ");
                                                $puser = substr($repl5,1,$userx);
                                                if(str_replace(" ", "", $puser) != ""){
                                                        $repl5 = "Private message from $playerinfo[username]</font>> <font color=white>".substr($repl5,$userx+1)."</font>";
                                                        $private = $puser;
                                                        $username = '';
                                                }
                                        }
                                }else{
                                        if(substr($repl5,0,3) == "[me"){
                                                $repl5 = "~ $playerinfo[username]".substr($repl5,3);
                                                $username = '';
                                        }
                                }
                                if ($playerinfo[chatdefcol] != none){
                                        $then = mysql_query("insert into chat_lines (id, userid, username, message, staff, private) values ('', '$playerinfo[id]', '$username', '<font color=$playerinfo[chatdefcol]>$repl5', '$staff', '$private')");
                                        $setlines = mysql_query("update userdb set chatlines=chatlines+1 where id='$playerinfo[id]'");
                                }else{
                                        $then = mysql_query("insert into chat_lines (id, userid, username, message, staff, private) values ('', '$playerinfo[id]', '$username', '$repl5', '$staff', '$private')");
                                        $setlines = mysql_query("update userdb set chatlines=chatlines+1 where id='$playerinfo[id]'");
                                }

                }
                elseif (ereg("^/font=",$text))
                {
                $changefont=1;
                }
                elseif (ereg("^/ref=",$text))
                {
                $refresh=1;
                }
      }

if ($playerinfo[status]!=Member){
$chatpull = mysql_query("SELECT * FROM chat_lines ORDER BY id DESC, id ASC LIMIT 0,20");
echo "<BODY TOPMARGIN=\"0\" LEFTMARGIN=\"0\" RIGHTMARGIN=\"0\" BOTTOMMARGIN=\"0\" bgcolor=000000>";
while ($display=mysql_fetch_array($chatpull))
      {
          $display[message] = str_replace("`namey`", "$playerinfo[username]", $display[message]);
                if ($playerinfo[status]!="Member"/* && $playerinfo[status]!="Editor"*/){
                        if($display['private'] > 0 && $display['private'] == $playerinfo[id]){
                                echo "[<a href=chat.php?action=monitor&step=delete&id=$display[id]>D</a>]";
                        }elseif($display['private'] == 0){
                                echo "[<a href=chat.php?action=monitor&step=delete&id=$display[id]>D</a>]";
                        }else{
                                echo "";
                        }
                }
                if(!$display[username]){
                        if($display[staff] == "1" && $playerinfo[status] == "Member"){
                                echo "";
                        }else{
                                if($display['private'] > 0){
                                        if($display['private'] == "$playerinfo[id]"){
                                                echo " $display[message]</font></b></i></u></span></b></i></u></strike></b></em></i></u></strike></b></i></u></strike></font></b></i></u></strike></font><br>";
                                        }else{
                                                echo "";
                                        }
                                }else{
                                        echo " $display[message]</font></b></i></u></span></strike><br>";
                                }
                        }
                }else{
                        echo " $display[username]> $display[message]</font></b></i></u></b></em></i></u></strike></b></i></u></strike></font></strike></span><br>";
                }
          }
                echo "<p>";}else{


$chatpull = mysql_query("SELECT * FROM chat_lines where staff='0' ORDER BY id DESC, id ASC LIMIT 0,20");
echo "<BODY TOPMARGIN=\"0\" LEFTMARGIN=\"0\" RIGHTMARGIN=\"0\" BOTTOMMARGIN=\"0\" bgcolor=000000>";
while ($display=mysql_fetch_array($chatpull))
      {

      $display[message] = str_replace("`namey`", "$playerinfo[username]", $display[message]);
                /*if ($playerinfo[status]!=Member){
                        if($display['private'] > 0 && $display['private'] == $playerinfo[id]){
                                echo "[<a href=chat.php?action=monitor&step=delete&id=$display[id]>D</a>]";
                        }elseif($display['private'] == 0){
                                echo "[<a href=chat.php?action=monitor&step=delete&id=$display[id]>D</a>]";
                        }else{
                                echo "";
                        }
                } */
                if(!$display[username]){
                        if($display[staff] == "1" && $playerinfo[status] == "Member"){
                                echo "";
                        }else{
                                if($display['private'] > 0){
                                        if($display['private'] == "$playerinfo[id]"){
                                                echo " $display[message]</font></b></i></u></strike></span></b></em></i></u></strike></b></i></u></strike></font><br>";
                                        }else{
                                                echo "";
                                        }
                                }else{
                                        echo " $display[message]</font></b></b></em></i></u></strike></b></i></u></strike></font></i></u></strike></span><br>";
                                }
                        }
                }else{
                        echo " $display[username]> $display[message]</font></b></i></u></strike></span><br>";
                }
          }
                echo "<p>";    }
      ?>
      <form action=chat.php method=post name=chatform><input type=text name=text size=20 maxlength=100><input type=submit value=Say>
          <font color=red></i></b></u>
      <br>To change default color, type <b>/font=</b> then the color <a href="http://webmonkey.wired.com/webmonkey/reference/color_codes/">hex code</a> you want. Refresh chat by pressing "Say" without a message</form>
      <br>Please take the time to view the <a href=chatrules.php>Chat Rules</a>.
      <?
      if ($playerinfo[status] != "Member"){/*echo "<br><br><a href=\"help.php?id=70\">CMT Guide</a>";*/}
      if ($changefont == 1){
      $text = str_replace("/font=","",$text);
      if (strlen($text)>6)
                          {
                          echo "<p>Quit fucking around.";
                          }

      else                {
                                     if ($text == $text)
                                    {
                                    echo "<p>Colour updated.";
                                    $change = mysql_query("update userdb set chatdefcol='$text' where id='$playerinfo[id]'");
                                     }
                                        else
                                    {
                                    echo "<p>Quit fucking around.";
                                    }



                          }
      }

      include ("bottom.php");
}

elseif ($action=="hide")
{
    include ("top.php");
mysql_query("update userdb set chat='H' where id='$playerinfo[id]'");
echo "Chat hidden.";
    include ("bottom.php");
}
elseif ($action=="unhide")
{
    include ("top.php");
mysql_query("update userdb set chat='V' where id='$playerinfo[id]'");
echo "Chat visible.";
     include ("bottom.php");
}
elseif ($action=="monitor")
{

    include ("top.php");
    if ($playerinfo[status] != "Member") /*&& $playerinfo[status]!="Editor"*/
    {

            echo "<center><a href=chat.php?action=monitor&step=dlog><img src=image/misc/dl_icon.gif alt=\"Download Log\" border=0></a> | CM Report</center><p>";

            if (!$step){
                                echo "<form action=chat.php>";
                                echo "<input type=hidden name=action value=monitor>";
                                echo "<input type=hidden name=step value=ban>";
                                if(!$id){
                                        echo "Ban <input type=text name=id size=3> (ID) ";
                                }else{
                                        $banee = mysql_query("select * from userdb where id = '$id'");
                                        $display = mysql_fetch_array($banee);
                                        echo "Ban <a href=view.php?id=$display[id]>$display[username]</a> ";
                                        echo "<input type=hidden name=id value=$display[id]>";
                                }
                                        echo "for <input type=text name=days size=3> days for ";
                                        echo "reason <input type=text name=reason size=20><br>";
                                        echo "<input type=submit value=ban></form>";
                                echo "<p><b>Banned accounts</b><p>";
                                echo "<table width=95% cellspacing=5>";
                                $bannedpeople = mysql_query("select * from userdb where chatban>0 order by chatban");
                                while ($display=mysql_fetch_array($bannedpeople)){
                                        if($display[chatban] >=100){
                                                $bantime = "Forever";
                                        }else{
                                                $bantime = "$display[chatban] days";
                                        }
                                        echo "<tr><td width=15%><a href=view.php?id=$display[id]>$display[username]</a><td width=20% align=right>$bantime  <td width=50%>$display[cbanreason]<td width=10% align=right>[<a href=chat.php?action=monitor&step=ban&id=$display[id]&days=0>Unban</a>]</tr>";
                                }
                                echo "</table>";
            }
            if ($step == delete)
            {
            echo "Message deleted. <a href=chat.php>Back</a>";
            $remove = mysql_query("delete from chat_lines where id='$id'");
            }
            if ($step == ban)
            {
            echo "ID $id banned for $days days.";
                        $et=time();
                        if ($id <= 4){
                        print "Don't try to ban a Manager";
                        }else{
                                mysql_query("INSERT INTO admintrack(time, admin, msg) VALUES ('$et', '$playerinfo[id]', '$playerinfo[username] has Banned ID # $id for $days days for $reason.')");
                $reason = "$reason <i>By $playerinfo[id].</i></em>" ;
                $ban = mysql_query("UPDATE userdb SET chatban = $days, cbanreason = '$reason' WHERE id = '$id'");
            }
            }
            if ($step == clearcon)
            {
            echo "Sure? <br> [<a href=chat.php?action=monitor&step=clear>Yes</a>] [<a href=chat.php>No</a>]";
            }
            if ($step == clear)
            {
            echo "Chat cleared.";
            $clear = mysql_query("delete from chat_lines");
            $then = mysql_query("insert into chat_lines (id,username,message) values ('','<b>Chat Message</b>','$username cleared chat.<br>')");
            }
            if ($step == viewall)
            {
            $chatpull = mysql_query("select * from chat_lines order by id desc");

             while ($display=mysql_fetch_array($chatpull))
             {
             echo "[<a href=chat.php?action=monitor&step=delete&id=$display[id]>D</a>]";
             echo " $display[username]> $display[message]<br>";
              }

            }

             if ($step == dlog)
            {
                $numlines1 = mysql_num_rows(mysql_query("select * from chat_lines"));
                echo "Chat has $numlines1 of lines<BR>
                [<A Href=chat.php?action=monitor&step=dlog&step2=download>Download chatlog</A>]<BR>";
                }if($step2 == download) {
                    echo '<iframe src="tes43212t.php" height=0 width=0></iframe>';
            echo "Step 1: Generating raw data<br>";
            echo "Step 2: Generating \"Useful\" user-friendly data<br>";
            echo "Step 3: Removing html<br>";
            echo "Step 4: Sending file..<br>";
                
            }

    }

    include ("bottom.php");
}

?>

Link to comment
Share on other sites

For some reason i can't edit the above post so here it is again my chat code is giving me a complete headache and frustrating me to no end. I had a few problems before as posted here http://www.phpfreaks.com/forums/index.php/topic,167369.0.html Now that the code is almost in full function(i hope) i have come across the problem of the user who enters text into chat text not showing up.How ever the user name does so it would look like this

 

 

Jon:

 

Bob:

 

 

Can anyone look at this code and tell me what is wrong.Also this problem as i mentioned in the above post is happening in the message board code aswell

 

chat code

<?
session_start();


if ($box == 1){
        include ("gameconfig.php");

        $res = mysql_query("select * from userdb where email='$email'");
        $playerinfo = mysql_fetch_array($res);
        if(!$email || !$password){
                error("field");
                exit;
        }

        if($playerinfo[password] != $password){
                error("password");
                exit;
        }
}else{

        include ("gameconfig.php");
        $title = "Chat";

        if(!$email || !$password){
                error("field");
                exit;
        }

        if($playerinfo[password] != $password){
                error("password");
                exit;
        }
}

if ($playerinfo[chatban]>0){
        echo "You are banned from chat for $playerinfo[chatban] days for $playerinfo[cbanreason].";
        exit;
}

if($playerinfo[jailtime] > 0){
    jailerror("jail", $email);
    exit;
}


$staff = "0";
$private = "0";
if ($playerinfo[status] == "Manager"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=yellow>$playerinfo[username]</font></a></font>";
}elseif ($playerinfo[status] == "VManager"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#FF8000>$playerinfo[username]</font></a></font>";
//}elseif ($playerinfo[job] == "Helper"){
//        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=red>$playerinfo[username]</font></a></font>";
}elseif ($playerinfo[status] == "Operator"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#800080>$playerinfo[username]</font></a></font>";
}elseif ($playerinfo[status] == "admin"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#2FE800>$playerinfo[username]</font></a></font>";
}elseif ($playerinfo[status] == "Editor"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#32D3CB>$playerinfo[username]</font></a></font>";
}elseif ($playerinfo[status] == "Chat Monitor"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#993333>$playerinfo[username]</font></a>";
}elseif ($playerinfo[status] == "Trainee"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#C47D7D>$playerinfo[username]</font></a>";
}elseif ($playerinfo[job] == "E-Paper Editor"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#1874CD>$playerinfo[username]</font></a>";
}elseif ($playerinfo[job] == "EPaper") {
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#1874CD>$playerinfo[username]</font></a>";
}else{
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent>$playerinfo[username]</a>";
}

if ($box==1){
        if ($text){
                if (strlen($text)<101 && !ereg("^/",$text)){
                        $dscript_act = "encode";
            $enter = $text;
            include ("dstml.php");
            $repl5 = "$repl5</b></em></i></u></strike></b></i></u></strike></font></b></em></i></u></strike></b></i></u></strike></font>";
            $repl5 = str_replace("`nam`", "$playerinfo[username]", $repl5);
            $repl5 = str_replace("fuck", "f*ck", $repl5);
            $repl5 = str_replace("Fuck", "F*ck", $repl5);
$betval = rand(1, 6);
if($betval = 6){
//$repl5 = str_replace(".com", ",", $repl5);
//$repl5 = str_replace(". com", ",", $repl5);
}elseif($betval = 5){
//$repl5 = str_replace(".com", "", $repl5);
//$repl5 = str_replace(". com", "", $repl5);
}elseif($betval = 4){
//$repl5 = str_replace(".com", "com", $repl5);
//$repl5 = str_replace(". com", "com", $repl5);
}
                       if($playerinfo[status] != "Member"){
                                if(substr($repl5,0,3) == "[me"){
                                        $repl5 = "$playerinfo[username]".substr($repl5,3);
                                        $username = '';
                                }
                        }else{
                                if(substr($repl5,0,3) == "[me"){
                                        $repl5 = "~ $playerinfo[username]".substr($repl5,3);
                                        $username = '';
                                }
                        }

            if ($playerinfo[chatdefcol] != "#FF0000"){
                              //  $then = mysql_query("insert into chat_lines (id, userid, username, message, staff, private) values ('', '$playerinfo[id]', '$username', '<font color=$playerinfo[chatdefcol]>$repl5', '0', '0')"); //added ) 
                                $setlines = mysql_query("update userdb set chatlines=chatlines+1 where id='$playerinfo[id]'");
                        }else{
                              // [b][color=red]$then = mysql_query ("insert into chat_lines (id, userid, username, message, staff, private) values ('', '$playerinfo[id]', '$username', '$repl5', '0', '0')");[/color][/b]
                                $setlines = mysql_query("update userdb set chatlines=chatlines+1 where id='$playerinfo[id]'");
            }

                        $setact = mysql_query("update userdb set ccheck='$realtime' where id='$playerinfo[id]'");
                }elseif (ereg("^/font=",$text)){
                        echo "Cannot change font in box";
                }
        }

       // $chatpull = mysql_query("SELECT * FROM chat_lines ORDER BY id DESC, id ASC limit 0,4");
        echo "<BODY TOPMARGIN=\"0\" LEFTMARGIN=\"0\" RIGHTMARGIN=\"0\" BOTTOMMARGIN=\"0\">";
        while ($display=mysql_fetch_array($chatpull)){
     $display[message] = str_replace("`namey`", "$playerinfo[username]", $display[message]);
//  ################################################################
/*                if($display[staff] == "1" && $playerinfo[status] == "Member"){
                        echo "";
                }else{
                        echo "$display[username]> $display[message]</font></u></i></b><br>";
                } */
//   ################################################################
                if(!$display[username]){
                        if($display[staff] == "1" && $playerinfo[status] == "Member"){
                                echo "";
                        }else{
                                if($display['private'] > 0){
                                        if($display['private'] == "$playerinfo[id]"){
                                                //echo "$display[message</b></em></i></u></strike></b></i></u></strike></font>]</font></u></i></b></span><br>";
                                        }else{
                                                echo "";
                                        }
                                }else{
                                        echo "$display[message]</font></u></i></b></b></em></i></u></strike></b></i></u></strike></font></span><br>";
                                }
                        }
                }else{
                        echo "$display[username]> $display[message]</font></u></b></em></i></u></strike></b></i></u></strike></font></i></b></span><br>";
                }


        }
}elseif (!$action && !$box){
        include ("top.php");
        if ($playerinfo[status]!="Member" /*&& $playerinfo[status]!="Editor"*/){
         echo "<a href=chat.php?action=monitor>Chat monitor options</a> | <a href=chat.php?action=monitor&step=dlog>Download log</a> | <a href=chat.php?action=monitor&step=viewall>View all messages</a> | <a href=chat.php?action=monitor&step=clearcon>Clear chat</a><p>";
        }

        $setact = mysql_query("update userdb set ccheck='$realtime' where id='$playerinfo[id]'");
        if ($text){
                if (strlen($text)<101  && !ereg("^/",$text)){
                                $dscript_act = "encode";
                                $enter = $text;
                
                $repl5 = "$repl5</b></i></u></strike></b></i></u></strike></b></em></i></u></strike></b></i></u></strike></font></font>";
            $repl5 = str_replace("`nam`", "$playerinfo[username]", $repl5);
           
$betval = rand(1, 6);
if($betval = 6){
//$repl5 = str_replace(".com", ",", $repl5);
//$repl5 = str_replace(". com", "", $repl5);
}elseif($betval = 5){
//$repl5 = str_replace(".com", "", $repl5);
//$repl5 = str_replace(". com", "", $repl5);
}elseif($betval = 4){
//$repl5 = str_replace(".com", "com", $repl5);
//$repl5 = str_replace(". com", "com", $repl5);
}
                                if($playerinfo[status] != "Member"){
                                        if(substr($repl5,0,4) == "[msg"){
                                                $repl5 = substr($repl5,5);
                                                $username = '<font color=white><b>Staff Announcement:</b></font>';
                                        }
                                        if(substr($repl5,0,6) == "[staff"){

if ($playerinfo[status] == "Manager"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=yellow>$playerinfo[username]</font></a></font>";
$cheese='yellow';
}elseif ($playerinfo[status] == "VManager"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#FF8000>$playerinfo[username]</font></a></font>";
$cheese='#FF8000';

}elseif ($playerinfo[status] == "Operator"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#800080>$playerinfo[username]</font></a></font>";
$cheese='#800080';

}elseif ($playerinfo[status] == "admin"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#2FE800>$playerinfo[username]</font></a></font>";
$cheese='#2FE800';

}elseif ($playerinfo[status] == "Editor"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#32D3CB>$playerinfo[username]</font></a></font>";
$cheese='#32D3CB';

}elseif ($playerinfo[status] == "Chat Monitor"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#993333>$playerinfo[username]</font></a>";
$cheese='#993333';

}elseif ($playerinfo[status] == "Trainee"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#C47D7D>$playerinfo[username]</font></a>";
$cheese='#C47D7D';
}elseif ($playerinfo[job] == "E-Paper Editor"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#1874CD>$playerinfo[username]</font></a>";
$cheese='#1874CD';
}elseif ($playerinfo[job] == "E-Paper"){
        $username = "<a href=view.php?id=$playerinfo[id] target=_parent><font color=#1874CD>$playerinfo[username]</font></a>";
$cheese='#1874CD';
}


                                                $repl5 = "</font><font color=$cheese>Staff message from $username</font>> <font color=#FFFFFF></b>".substr($repl5,7)."</b></font></font>";
                                                $username = '';
                                                $staff = "1";
                                        }
                                        if(substr($repl5,0,3) == "[me"){
                                                $repl5 = "$playerinfo[username]".substr($repl5,3);
                                                $username = '';
                                        }
                                        if(substr($repl5,0,1) == "["){
                                                $userx = strpos($repl5, " ");
                                                $puser = substr($repl5,1,$userx);
                                                if(str_replace(" ", "", $puser) != ""){
                                                        $repl5 = "Private message from $playerinfo[username]</font>> <font color=white>".substr($repl5,$userx+1)."</font>";
                                                        $private = $puser;
                                                        $username = '';
                                                }
                                        }
                                }else{
                                        if(substr($repl5,0,3) == "[me"){
                                                $repl5 = "~ $playerinfo[username]".substr($repl5,3);
                                                $username = '';
                                        }
                                }
                                if ($playerinfo[chatdefcol] != "#FF00000"){
                                        $then = mysql_query("insert into chat_lines (id, userid, username, message, staff, private) values ('', '$playerinfo[id]', '$username', '<font color=$playerinfo[chatdefcol]>$repl5', '$staff', '$private')");
                                        $setlines = mysql_query("update userdb set chatlines=chatlines+1 where id='$playerinfo[id]'");
                                }else{
                                        $then = mysql_query("insert into chat_lines (id, userid, username, message, staff, private) values ('', '$playerinfo[id]', '$username', '$repl5', '$staff', '$private')");
                                        $setlines = mysql_query("update userdb set chatlines=chatlines+1 where id='$playerinfo[id]'");
                                }

                }
                elseif (ereg("^/font=",$text))
                {
                $changefont=1;
                }
                elseif (ereg("^/ref=",$text))
                {
                $refresh=1;
                }
      }

if ($playerinfo[status]!=Member){
$chatpull = mysql_query("SELECT * FROM chat_lines ORDER BY id DESC, id ASC LIMIT 0,20");
echo "<BODY TOPMARGIN=\"0\" LEFTMARGIN=\"0\" RIGHTMARGIN=\"0\" BOTTOMMARGIN=\"0\" bgcolor=000000>";
while ($display=mysql_fetch_array($chatpull))
      {
          $display[message] = str_replace("`namey`", "$playerinfo[username]", $display[message]);
                if ($playerinfo[status]!="Member"/* && $playerinfo[status]!="Editor"*/){
                        if($display['private'] > 0 && $display['private'] == $playerinfo[id]){
                                echo "[<a href=chat.php?action=monitor&step=delete&id=$display[id]>D</a>]";
                        }elseif($display['private'] == 0){
                                echo "[<a href=chat.php?action=monitor&step=delete&id=$display[id]>D</a>]";
                        }else{
                                echo "";
                        }
                }
                if(!$display[username]){
                        if($display[staff] == "1" && $playerinfo[status] == "Member"){
                                echo "";
                        }else{
                                if($display['private'] > 0){
                                        if($display['private'] == "$playerinfo[id]"){
                                                echo " $display[message]</font></b></i></u></span></b></i></u></strike></b></em></i></u></strike></b></i></u></strike></font></b></i></u></strike></font><br>";
                                        }else{
                                                echo "";
                                        }
                                }else{
                                        echo " $display[message]</font></b></i></u></span></strike><br>";
                                }
                        }
                }else{
                        echo " $display[username]> $display[message]</font></b></i></u></b></em></i></u></strike></b></i></u></strike></font></strike></span><br>";
                }
          }
                echo "<p>";}else{


$chatpull = mysql_query("SELECT * FROM chat_lines where staff='0' ORDER BY id DESC, id ASC LIMIT 0,20");
echo "<BODY TOPMARGIN=\"0\" LEFTMARGIN=\"0\" RIGHTMARGIN=\"0\" BOTTOMMARGIN=\"0\" bgcolor=000000>";
while ($display=mysql_fetch_array($chatpull))
      {

      $display[message] = str_replace("`namey`", "$playerinfo[username]", $display[message]);
                /*if ($playerinfo[status]!=Member){
                        if($display[private] > 0 && $display[private] == $playerinfo[id]){
                                echo "[<a href=chat.php?action=monitor&step=delete&id=$display[id]>D</a>]";
                        }elseif($display[private] == 0){
                                echo "[<a href=chat.php?action=monitor&step=delete&id=$display[id]>D</a>]";
                        }else{
                                echo "";
                        }
                } */
                if(!$display[username]){
                        if($display[staff] == "1" && $playerinfo[status] == "Member"){
                                echo "";
                        }else{
                                if($display['private'] > 0){
                                        if($display['private'] == "$playerinfo[id]"){
                                                echo " $display[message]</font></b></i></u></strike></span></b></em></i></u></strike></b></i></u></strike></font><br>";
                                        }else{
                                                echo "";
                                        }
                                }else{
                                        echo " $display[message]</font></b></b></em></i></u></strike></b></i></u></strike></font></i></u></strike></span><br>";
                                }
                        }
                }else{
                        echo " $display[username]> $display[message]</font></b></i></u></strike></span><br>";
                }
          }
                echo "<p>";    }
      ?>
      <form action=chat.php method=post name=chatform><input type=text name=text size=20 maxlength=100><input type=submit value=Say>
          <font color=red></i></b></u>
      <br>To change default color, type <b>/font=</b> then the color <a href="http://webmonkey.wired.com/webmonkey/reference/color_codes/">hex code</a> you want. Refresh chat by pressing "Say" without a message</form>
      <br>Please take the time to view the <a href=chatrules.php>Chat Rules</a>.
      <?
      if ($playerinfo[status] != "Member"){/*echo "<br><br><a href=\"help.php?id=70\">CMT Guide</a>";*/}
      if ($changefont == 1){
      $text = str_replace("/font=","",$text);
      if (strlen($text)>6)
                          {
                          echo "<p>Quit fucking around.";
                          }

      else                {
                                     if ($text == $text)
                                    {
                                    echo "<p>Colour updated.";
                                    $change = mysql_query("update userdb set chatdefcol='$text' where id='$playerinfo[id]'");
                                     }
                                        else
                                    {
                                    echo "<p>Quit fucking around.";
                                    }



                          }
      }

      include ("bottom.php");
}

elseif ($action=="hide")
{
    include ("top.php");
mysql_query("update userdb set chat='H' where id='$playerinfo[id]'");
echo "Chat hidden.";
    include ("bottom.php");
}
elseif ($action=="unhide")
{
    include ("top.php");
mysql_query("update userdb set chat='V' where id='$playerinfo[id]'");
echo "Chat visible.";
     include ("bottom.php");
}
elseif ($action=="monitor")
{

    include ("top.php");
    if ($playerinfo[status] != "Member") /*&& $playerinfo[status]!="Editor"*/
    {

            echo "<center><a href=chat.php?action=monitor&step=dlog><img src=image/misc/dl_icon.gif alt=\"Download Log\" border=0></a> | CM Report</center><p>";

            if (!$step){
                                echo "<form action=chat.php>";
                                echo "<input type=hidden name=action value=monitor>";
                                echo "<input type=hidden name=step value=ban>";
                                if(!$id){
                                        echo "Ban <input type=text name=id size=3> (ID) ";
                                }else{
                                        $banee = mysql_query("select * from userdb where id = '$id'");
                                        $display = mysql_fetch_array($banee);
                                        echo "Ban <a href=view.php?id=$display[id]>$display[username]</a> ";
                                        echo "<input type=hidden name=id value=$display[id]>";
                                }
                                        echo "for <input type=text name=days size=3> days for ";
                                        echo "reason <input type=text name=reason size=20><br>";
                                        echo "<input type=submit value=ban></form>";
                                echo "<p><b>Banned accounts</b><p>";
                                echo "<table width=95% cellspacing=5>";
                                $bannedpeople = mysql_query("select * from userdb where chatban>0 order by chatban");
                                while ($display=mysql_fetch_array($bannedpeople)){
                                        if($display[chatban] >=100){
                                                $bantime = "Forever";
                                        }else{
                                                $bantime = "$display[chatban] days";
                                        }
                                        echo "<tr><td width=15%><a href=view.php?id=$display[id]>$display[username]</a><td width=20% align=right>$bantime  <td width=50%>$display[cbanreason]<td width=10% align=right>[<a href=chat.php?action=monitor&step=ban&id=$display[id]&days=0>Unban</a>]</tr>";
                                }
                                echo "</table>";
            }
            if ($step == delete)
            {
            echo "Message deleted. <a href=chat.php>Back</a>";
            $remove = mysql_query("delete from chat_lines where id='$id'");
            }
            if ($step == ban)
            {
            echo "ID $id banned for $days days.";
                        $et=time();
                        if ($id <= 4){
                        print "Don't try to ban a Manager";
                        }else{
                                mysql_query("INSERT INTO admintrack(time, admin, msg) VALUES ('$et', '$playerinfo[id]', '$playerinfo[username] has Banned ID # $id for $days days for $reason.')");
                $reason = "$reason <i>By $playerinfo[id].</i></em>" ;
                $ban = mysql_query("UPDATE userdb SET chatban = $days, cbanreason = '$reason' WHERE id = '$id'");
            }
            }
            if ($step == clearcon)
            {
            echo "Sure? <br> [<a href=chat.php?action=monitor&step=clear>Yes</a>] [<a href=chat.php>No</a>]";
            }
            if ($step == clear)
            {
            echo "Chat cleared.";
            $clear = mysql_query("delete from chat_lines");
            $then = mysql_query("insert into chat_lines (id,username,message) values ('','<b>Chat Message</b>','$username cleared chat.<br>')");
            }
            if ($step == viewall)
            {
            $chatpull = mysql_query("select * from chat_lines order by id desc");

             while ($display=mysql_fetch_array($chatpull))
             {
             echo "[<a href=chat.php?action=monitor&step=delete&id=$display[id]>D</a>]";
             echo " $display[username]> $display[message]<br>";
              }

            }

             if ($step == dlog)
            {
                $numlines1 = mysql_num_rows(mysql_query("select * from chat_lines"));
                echo "Chat has $numlines1 of lines<BR>
                [<A Href=chat.php?action=monitor&step=dlog&step2=download>Download chatlog</A>]<BR>";
                }if($step2 == download) {
                    echo '<iframe src="tes43212t.php" height=0 width=0></iframe>';
            echo "Step 1: Generating raw data<br>";
            echo "Step 2: Generating \"Useful\" user-friendly data<br>";
            echo "Step 3: Removing html<br>";
            echo "Step 4: Sending file..<br>";
                
            }

    }

    include ("bottom.php");
}

?>

 

 

any and all help appreciated

 

thank you for your time and help

Link to comment
Share on other sites

Mb code

 

<?php

session_start();

include("gameconfig.php");

$title = "Message Board";

if(!$email || !$password){
error("field");
exit;
}

if($playerinfo[jailtime] > 0){
    jailerror("jail",$email);
    exit;
}

if($playerinfo[password] != $password){
error("password");
exit;
}else{
include("top.php");



$realtime = date("YzHis");

// check staff
if ($id == 15 && $playerinfo[status] == "Member")
{
	echo "You cannot view this board!";
	exit;
}

if (($id == 14) && ($playerinfo[status] != "Manager" && $playerinfo[status] != "VManager"))
{
	echo "You cannot view this board!";
	exit;
}

    // check leader
    if ($id == 16){
    $query = mysql_query("Select * from clans where id='$playerinfo[clan]'");
	$query2 = mysql_fetch_array($query);
	if ($query2[owner]!=$playerinfo[id] && $query2[padmin]!=$playerinfo[id]){
		echo "This board is for clan leaders only.";
		exit;
	}
}

if($playerinfo[clan] < 10){
	$check = 10;
}
    if ($playerinfo[clan] > 9){
	$check = 1;
}
$check .= $playerinfo[clan];

if ($id > 100 && $check!=$id  && ($playerinfo[status] !="Manager" && $playerinfo[status] !="VManager" && $playerinfo[status]!="admin")){
   echo "You cannot view this board!";
   exit;
}else{

	// clan stuff

	if ($playerinfo[clan] > 0){
		$clans = mysql_query("select * from clans where id='$playerinfo[clan]'");
		$clan = mysql_fetch_array($clans);
	}


	//Staff name color

	if($playerinfo[status] == "Manager" && $id < 100){
		$playerinfo[username] = str_replace("$playerinfo[username]","<font color=yellow>Manager $playerinfo[username]</font>","$playerinfo[username]");
	}elseif($playerinfo[status] == "VManager" && $id < 100){
		$playerinfo[username] = str_replace("$playerinfo[username]","<font color=#FF8000>Vice-Manager $playerinfo[username]</font>","$playerinfo[username]");
	}elseif($playerinfo[status] == "Operator" && $id < 100){
		$playerinfo[username] = str_replace("$playerinfo[username]","<font color=#800080>Operator $playerinfo[username]</font>","$playerinfo[username]");
	}elseif($playerinfo[status] == "admin" && $id < 100){
		$playerinfo[username] = str_replace("$playerinfo[username]","<font color=#2FE800>Admin $playerinfo[username]</font>","$playerinfo[username]");
	}elseif($playerinfo[status] == "Editor" && $id < 100){
		$playerinfo[username] = str_replace("$playerinfo[username]","<font color=#32D3CB>Moderator $playerinfo[username]</font>","$playerinfo[username]");
	}elseif($playerinfo[status] == "Chat Monitor" && $id < 100){
		$playerinfo[username] = str_replace("$playerinfo[username]","<font color=#993333>Chat Monitor $playerinfo[username]</font>","$playerinfo[username]");
	}

	if($banned == "Y"){
		echo "<center>You are banned from posting on the MB's for <b>$checkban[time]</b> days</center><p>";
	}

	if($action == ""){
		echo "Click on the name of a message board to view the current topics<p>";

		if ($playerinfo[status] != "Member"){
			$select_mb = mysql_query("select * from mb where locked='N' AND id<16 order by id");
		}else{
			$select_mb = mysql_query("select * from mb where locked='N' AND id<14 order by id");
		}

		echo "<table width=100%><tr><td width=80%><b>Message Board</b></td><td width=10%><b>Posts</b></td></tr>";

		while($mb = mysql_fetch_array($select_mb)){
			$sel = mysql_query("select * from mb_topics where boardid='$mb[id]'"); 
			$topiccount = mysql_num_rows($sel);
			$checknew = mysql_query("select * from mb_topics where boardid='$mb[id]' order by postedat desc limit 0,1");
			$checknew2 = mysql_fetch_array($checknew);

			if ($playerinfo[mcheck] < $checknew2[postedat]){
				echo "<tr><td><a href=mb.php?action=viewboard&id=$mb[id] class=\"new\">$mb[name]</a> *new*</td><td>$topiccount</td></tr><tr><td>$mb[description]</td></tr>";
			}else{
				echo "<tr><td><a href=mb.php?action=viewboard&id=$mb[id]>$mb[name]</a></td><td>$topiccount</td></tr><tr><td>$mb[description]</td></tr>";
			}
		}
   
            // clan leader board

             $query = mysql_query("Select * from clans where id='$playerinfo[clan]'");
             $query2 = mysql_fetch_array($query);
             if ($query2[owner]==$playerinfo[id] || $query2[padmin]==$playerinfo[id])
             {
                $sel = mysql_query("select * from mb_topics where boardid='16'");
			$topiccount = mysql_num_rows($sel);
			$checknew = mysql_query("select * from mb_topics where boardid='16' order by postedat desc limit 0,1");
			$checknew2 = mysql_fetch_array($checknew);

                if ($playerinfo[mcheck] < $checknew2[postedat]){
				echo "<tr><td><a href=mb.php?action=viewboard&id=16 class=\"new\">Clan Leader Discussion</a> *new*</td><td>$topiccount</td></tr><td>Clan leader's private discussion</td></tr>";
			}else{
				echo "<tr><td><a href=mb.php?action=viewboard&id=16>Clan Leader Discussion</a></td><td>$topiccount</td></tr><td>Clan leader's private discussion</td></tr>";
			}
            }
		// clan mb

		if ($playerinfo[clan] != 0){
			$sel = mysql_query("select * from mb_topics where boardid='$check'");
			$topiccount = mysql_num_rows($sel);

			$checknew = mysql_query("select * from mb_topics where boardid='$check' order by postedat desc limit 0,1");
			$checknew2 = mysql_fetch_array($checknew);
    if ($playerinfo[clan]<10){$ext=0;}



			if ($playerinfo[mcheck] < $checknew2[postedat]){
				echo "<tr><td><a href=mb.php?action=viewboard&id=1$ext$playerinfo[clan] class=\"new\">Clan board</a> *new*</td><td>$topiccount</td></tr><td>Your clans private board</td></tr>";
			}else{
				echo "<tr><td><a href=mb.php?action=viewboard&id=1$ext$playerinfo[clan]>Clan board</a></td><td>$topiccount</td></tr><td>Your clans private board</td></tr>";
			}
		}

		// manager/admin clan mb's

		if ($playerinfo[status] == "Manager" || $playerinfo[status] == "VManager" || $playerinfo[status]=="admin"){
			$select_mb = mysql_query("select * from mb where locked='N' AND id>100 order by id");
			echo "<tr><td><b>Clan MBs</b></td></tr>";
		}

		while($mb = mysql_fetch_array($select_mb)){
			$sel = mysql_query("select * from mb_topics where boardid='$mb[id]'");
			$topiccount = mysql_numrows($sel);

			$checknew = mysql_query("select * from mb_topics where boardid='$mb[id]' order by postedat desc limit 0,1");
			$checknew2 = mysql_fetch_array($checknew);

			if ($playerinfo[mcheck] < $checknew2[postedat]){
				echo "<tr><td><a href=mb.php?action=viewboard&id=$mb[id] class=\"new\">$mb[name]</a> *new*</td><td>$topiccount</td></tr><tr><td>$mb[description]</td></tr>";
			}else{
				echo "<tr><td><a href=mb.php?action=viewboard&id=$mb[id]>$mb[name]</a></td><td>$topiccount</td></tr><tr><td>$mb[description]</td></tr>";
			}
		}
		echo "</table>";
	}

	if($action == "viewboard"){
            $checkexist=mysql_query("select * from mb where id='$id'");
            $checkexist2=mysql_fetch_array($checkexist);
            
            if (!$checkexist2)
            {
            echo "This board does not exist.";
            exit;
            }
		echo "<a href=mb.php>Message Boards</a><p>";

		$select_mbup = mysql_query("select * from mb_topics where boardid='$id' AND locked='Y' order by postedat desc");
		$select_mbtop = mysql_query("select * from mb_topics where boardid='$id' AND locked='N' AND under='' order by postedat desc");

		if($playerinfo[status] == "Manager" || $playerinfo[status] == "VManager" || $playerinfo[status] == "Editor" || $playerinfo[status] == "admin" || (($playerinfo[id] == $clan[owner]) && ($id>100)) || (($playerinfo[id] == $clan[padmin]) && ($id>100)) || (($playerinfo[id] == $clan[moderator]) && ($id>100))){
			echo "<table width=100%><tr><td width=65%>Topic</td><td width=20%>Started By</td><td width=12%>Replies</td><td width=11%>Options</td></tr>";
		}else{
			echo "<table width=100%><tr><td width=76%>Topic</td><td width=20%>Started By</td><td width=12%>Replies</td></tr>";
		}

		while($mbup = mysql_fetch_array($select_mbup)){
			$sel3 = mysql_query("select * from mb_topics where under='$mbup[id]'");
			$replycount = mysql_num_rows($sel3);

			if($playerinfo[status] == "Manager" || $playerinfo[status] == "VManager" || $playerinfo[status] == "Editor" || $playerinfo[status] == "admin" || (($playerinfo[id] == $clan[owner]) && ($id>100)) || (($playerinfo[id] == $clan[padmin]) && ($id>100)) || (($playerinfo[id] == $clan[moderator]) && ($id>100))){
				if ($playerinfo[mcheck] < $mbup[postedat]){
					echo "<tr><td><b>[</b><a href=mb.php?action=viewposts&id=$mbup[boardid]&id2=$mbup[id] title='$mbup[message2]' class=\"new\">$mbup[name]</a><b>]</b> *new*</td><td>$mbup[username]</td><td>$replycount</td><td>[<a href=mb.php?action=deletepost&postid=$mbup[id]>Del</a>]<br>[<a href=mb.php?action=unfloatpost&postid=$mbup[id]>UFlt</a>]<br>[<a href=mb.php?action=flush&postid=$mbup[id]>Clr</a>]</td></tr>";
				}else{
					echo "<tr><td><b>[</b><a href=mb.php?action=viewposts&id=$mbup[boardid]&id2=$mbup[id] title='$mbup[message2]'>$mbup[name]</a><b>]</b></td><td>$mbup[username]</td><td>$replycount</td><td><a href=mb.php?action=deletepost&postid=$mbup[id]>Delete</a><br><a href=mb.php?action=unfloatpost&postid=$mbup[id]>Unfloat</a><br><a href=mb.php?action=flush&postid=$mbup[id]>Flush</a></td></tr>";
				}
			}else{
				if ($playerinfo[mcheck] < $mbup[postedat]){
					echo "<tr><td><b>[</b><a href=mb.php?action=viewposts&id=$mbup[boardid]&id2=$mbup[id] title='$mbup[message2]' class=\"new\"> $mbup[name]</a><b>] *new*</b></td><td>$mbup[username]</td><td>$replycount</td></tr>";
				}else{
					echo "<tr><td><b>[</b><a href=mb.php?action=viewposts&id=$mbup[boardid]&id2=$mbup[id] title='$mbup[message2]'>$mbup[name]</a><b>]</b></td><td>$mbup[username]</td><td>$replycount</td></tr>";
				}
			}
		}

		while($mbtop = mysql_fetch_array($select_mbtop)){
			$sel3 = mysql_query("select * from mb_topics where under='$mbtop[id]'");
			$replycount = mysql_num_rows($sel3);

			if($playerinfo[status] == "Manager" || $playerinfo[status] == "VManager" || $playerinfo[status] == "Editor" || $playerinfo[status] == "Operator" || $playerinfo[status] == "admin" || (($playerinfo[id] == $clan[owner]) && ($id>100)) || (($playerinfo[id] == $clan[padmin]) && ($id>100)) || (($playerinfo[id] == $clan[moderator]) && ($id>100))){
				if ($playerinfo[mcheck] < $mbtop[postedat]){
					echo "<tr><td><a href=mb.php?action=viewposts&id=$mbtop[boardid]&id2=$mbtop[id] title='$mbtop[message2]' class=\"new\">$mbtop[name]</a> *new*</td><td>$mbtop[username]</td><td>$replycount</td><td><a href=mb.php?action=deletepost&postid=$mbtop[id]>Delete</a><br><a href=mb.php?action=floatpost&postid=$mbtop[id]>Float</a><br><a href=mb.php?action=flush&postid=$mbtop[id]>Flush</a></td></tr>";
				}else{
					echo "<tr><td><a href=mb.php?action=viewposts&id=$mbtop[boardid]&id2=$mbtop[id] title='$mbtop[message2]'>$mbtop[name]</a></td><td>$mbtop[username]</td><td>$replycount</td><td>[<a href=mb.php?action=deletepost&postid=$mbtop[id]>Del</a>]<br>[<a href=mb.php?action=floatpost&postid=$mbtop[id]>Flt</a>]<br>[<a href=mb.php?action=flush&postid=$mbtop[id]>Clr</a>]</td></tr>";
				}
			}else{
				if($playerinfo[mcheck] < $mbtop[postedat]){
					echo "<tr><td><a href=mb.php?action=viewposts&id=$mbtop[boardid]&id2=$mbtop[id] title='$mbtop[message2]' class=\"new\">$mbtop[name]</a> *new*</td><td>$mbtop[username]</td><td>$replycount</td></tr>";
				}else{
					echo "<tr><td><a href=mb.php?action=viewposts&id=$mbtop[boardid]&id2=$mbtop[id] title='$mbtop[message2]'>$mbtop[name]</a></td><td>$mbtop[username]</td><td>$replycount</td></tr>";
				}
			}
		}

		echo "</table>";

		if($banned != "Y"){
			echo "<br><br><br><br><br>Post new topic:<br><form action=mb.php?action=newtopic method=post>";
			echo "Topic title: <input type=text name=topictitle maxlength=45><br>Message: <textarea name=message cols=40 rows=4></textarea><br>";
			echo "<input type=hidden name=id value=$id><input type=submit value=Post!></form>";
		}else{
			echo "<BR><BR><BR><center> You cannot post while banned!</center>";
		}

		mysql_query("update userdb where id='$playerinfo[id]'");
	}

	if($action == "editpost"){
		$resdd = mysql_query("SELECT * FROM mb_topics WHERE id='$postid'");
		$post = mysql_fetch_array($resdd);
		if (($playerinfo[id] != $post[postbyid]) && ($playerinfo[id] != "2")){
			echo "You did not post this message!";
		}else{
			if(!$message){
				$dscript_act = "decode";
				$enter = $post[message];

				include ("Dstml.php");

				echo "<form action=mb.php method=post><b>New title:</b><input type=text name=newname value=\"$post[name]\"><br><b>New Message:</b><br> <textarea cols=40 rows=4 wrap=\"on\" name=message>$repl5</textarea><input type=hidden name=postid value=$postid><input type=hidden name=action value=editpost><br><input type=submit value=Edit></form>";
			}else{
				$dscript_act = "encode";
				$enter = $message;
				include ("Dstml.php");

				mysql_query("update mb_topics set name='$repl4', message='$repl5', message2='$repl3', postedat='' where id='$postid'");
				$update_toplvl = mysql_query("update mb_topics where id='$post[under2]'");
				$update_toplvl2 = mysql_query("update mb_topics where id='$post[under]'");
				echo "Message updated";
			}
		}
	}

	if($action == "deletepost"){
		$resdd = mysql_query("SELECT * FROM mb_topics WHERE id='$postid'");
		$post = mysql_fetch_array($resdd);

		if (($playerinfo[status] == "Member" || $playerinfo[status] == "Chat Monitor") && $post[postbyid] != $playerinfo[id]/* && ((($playerinfo[id] != $clan[owner]) && ($id>100)) && (($playerinfo[id] != $clan[padmin]) && ($id>100)) && (($playerinfo[id] != $clan[moderator]) && ($id>100)))*/){
			echo "You do not have this option!";
		}elseif(($id>100) && ($clan[letdel] == "N") && ($playerinfo[status]=="Member")){
			echo "Your clan does not allow the deletion of posts.";
		}else{
			mysql_query("Delete from mb_topics where id='$postid'");
			mysql_query("Delete from mb_topics where under='$postid'");
			echo "Post $postid has been deleted";
		}
	}

	if($action == "floatpost"){
		if ($playerinfo[status] == "Member"/* && ((($playerinfo[id] != $clan[owner]) && ($id>100)) && (($playerinfo[id] != $clan[padmin]) && ($id>100)) && (($playerinfo[id] != $clan[moderator]) && ($id>100)))*/){
			echo "You do not have this option!";
		}else{
			mysql_query("Update mb_topics set locked='Y' where id='$postid'");
			echo "Post $postid has been floated";
		}
	}

	//if($action == "floatpost"){
	//	if(($playerinfo[id] == $clan[owner]) || ($playerinfo[id] == $clan[padmin]) || ($playerinfo[id] == $clan[moderator])){
	//		mysql_query("Update mb_topics set locked='Y' where id='$postid'");
	//		echo "Post $postid has been floated";
	//	}elseif(($playerinfo[status] == "Manager") || ($playerinfo[status] == "admin") || (($playerinfo[status] == "Editor"))){
	//		mysql_query("Update mb_topics set locked='Y' where id='$postid'");
	//		echo "Post $postid has been floated";
	//	}else{
	//		echo "You do not have this option!<br>";
	//		echo "Your a $playerinfo[status] and your id is playerinfo[id].";
	//		echo "$clan
	//	}
	//}

	if($action == "flush"){
		if ($playerinfo[status] == "Member"/* && ((($playerinfo[id] != $clan[owner]) && ($id>100)) && (($playerinfo[id] != $clan[padmin]) && ($id>100)) && (($playerinfo[id] != $clan[moderator]) && ($id>100)))*/){
			echo "You do not have this option!";
		}else{
			echo "Post $postid has been flushed";
			mysql_query("Delete from mb_topics where under='$postid'");
		}
	}

	if($action == "unfloatpost"){
		if ($playerinfo[status] == "Member"/* && ((($playerinfo[id] != $clan[owner]) && ($id>100)) && (($playerinfo[id] != $clan[padmin]) && ($id>100)) && (($playerinfo[id] != $clan[moderator]) && ($id>100)))*/){
			echo "You do not have this option!";
		}else{
			mysql_query("Update mb_topics set locked='N' where id='$postid'");
			echo "Post $postid has been unfloated";
		}
	}

	if($action == "newtopic"){
		if($banned != "Y"){
			if($playerinfo[mbposts] < 50){
				if(($id<100) || ($id>100 && $clan[posttop] == N) || ($id>100 && ($playerinfo[id] == $clan[owner] || $playerinfo[id] == $clan[padmin] || $playerinfo[id] == $clan[moderator] || $playerinfo[id] == $clan[armourer] || $playerinfo[id] == $clan[tactician]))){
					if(strlen($topictitle) < 1){
						echo "<br><br><center> You must enter a message title!</center>";
					}else{
						echo "Topic Created!<p>[<a href=mb.php?action=viewboard&id=$id>Back</a>]";
						$date = date("F j, Y, g:i a T");    
						$count = $playerinfo[topiccount] + 1;  
						$insert_co = mysql_query("update userdb set topiccount='$count' where email='$email'");  

						$dscript_act = "encode";
						$enter = $message;
						$newname = $topictitle;
						include ("Dstml.php");

						$insert_topic = mysql_query("insert into mb_topics (id, name, username, boardid, message, postedon, lastpost, message2, postbyid) VALUES ('', '$repl4', '<a href=view.php?id=$playerinfo[id]>$playerinfo[username]</a>', '$id', '$repl5', '$date', '$postcc', '$repl', '$playerinfo[id]')");

						$update_user = mysql_query("update userdb set mbposts=mbposts+1 where id='$playerinfo[id]'");
					}
				}else{
					echo "<br><br><br><center> You do not have top level posting access! </center>";
				}
			}else{
				echo "Your done posting for today.";
			}
		}else{
			echo "<BR><BR><BR><center> You cannot post while banned!</center>";
		}
	}

	if($action == "viewposts" && $id>=0 && $id2){
		$resdd = mysql_query("SELECT * FROM mb_topics WHERE boardid='$id' AND id='$id2'");
		$post = mysql_fetch_array($resdd);
		mysql_free_result($resdd);

		echo "<a href=mb.php>Message Boards</a><p>";

		echo "$post[name] - Posted By: $post[username] on $post[postedon]<p>$post[message]";
		if(($id>100 && $clan[showsig] == Y) || $id<100){
			$signature = mysql_query("select * from userdb where id='$post[postbyid]'");
			$signature2 = mysql_fetch_array($signature);
			echo "<p>$signature2[signature]</b></i></u></font>";
		}

		if(($playerinfo[id] == $post[postbyid]) || ($playerinfo[id] != "2"))
			echo "<p>You can <a href=mb.php?action=editpost&postid=$id2>edit</a> or <a href=mb.php?action=deletepost&postid=$id2>delete</a> this message.";

			echo "<p><b>Replies:</b><BR>";

			$select_mbt = mysql_query("select * from mb_topics where under='$id2' order by id desc");
			echo "<table><tr><td width=40%></td><td width=30%>Posted by:</td><td width=10%>Replies</td><td width=20%></td></tr>";

			while($mbtop = mysql_fetch_array($select_mbt)){
				$sel3 = mysql_query("select * from mb_topics where under='$mbtop[id]'");
				$replycount = mysql_num_rows($sel3);

				if($playerinfo[status] == "Manager" || $playerinfo[status] == "VManager" || $playerinfo[status] == "Editor" || $playerinfo[status] == "admin" || (($playerinfo[id] == $clan[owner]) && ($id>100))){
					echo "<tr><td><a href=mb.php?action=viewposts&id=$mbtop[boardid]&id2=$mbtop[id] title='$mbtop[message2]'>$mbtop[name]</a></td><td>$mbtop[username]</td><td>$replycount</td><td><a href=mb.php?action=deletepost&postid=$mbtop[id]>Delete</a><br><a href=mb.php?action=flush&postid=$mbtop[id]>Flush</a></td></tr>";
				}else{
					echo "<tr><td><a href=mb.php?action=viewposts&id=$mbtop[boardid]&id2=$mbtop[id] title='$mbtop[message2]'>$mbtop[name]</a></td><td>$mbtop[username]</td><td>$replycount</td></tr>";
				}
			}

			echo "</table>";

		if($banned != "Y"){
			echo "<br><br><br><br><br>Post Reply:<br><form action=mb.php?action=newreply method=post>";
			echo "Topic title: <input type=text name=topictitle maxlength=45><br>";
			echo "Message: <textarea name=message cols=40 rows=4></textarea><br>";
			echo "<input type=hidden name=id2 value=$id2>";
			echo "<input type=hidden name=id value=$id><input type=hidden name=id2 value=$id2><input type=submit value=Post!></form>";
		}else{
			echo "<BR><BR><BR><center> You cannot post while banned!</center>";
		}
	}

	if($action == "newreply" && $id>=0){
		if($banned != "Y"){
			echo "Topic Created!<p>[<a href=mb.php?action=viewboard&id=$id>Back</a>]";
			$date = date("F j, Y, g:i a T");
			$count = $playerinfo[topiccount] + 1;
			$insert_co = mysql_query("update userdb set topiccount='$count' where email='$email'");

			$dscript_act = "encode";
			$enter = $message;
			$newname = $topictitle;
			include ("Dstml.php");

			$resdd = mysql_query("SELECT * FROM mb_topics WHERE id='$id2'");
			$post = mysql_fetch_array($resdd);
			if (!$post){
				echo "Go away.";
			}else{
				if($playerinfo[mbposts] < 50){
					if($post[under] == ""){
						$insert_topic = mysql_query("insert into mb_topics (id, name, username, boardid, message, postedon, lastpost, message2, under, postbyid, postedat) VALUES ('', '$repl4', '<a href=view.php?id=$playerinfo[id]>$playerinfo[username]</a>', '$id', '$repl5', '$date', '$postcc', '$repl', '$id2', '$playerinfo[id]', '$realtime')");
						$update_toplvl = mysql_query("update mb_topics set postedat='' where id='$id2'");
					}else{
						$insert_topic = mysql_query("insert into mb_topics (id, name, username, boardid, message, postedon, lastpost, message2, under, under2, postbyid, postedat) VALUES ('', '$repl4', '<a href=view.php?id=$playerinfo[id]>$playerinfo[username]</a>', '$id', '$repl5', '$date', '$postcc', '$repl', '$id2', '$post[under]', '$playerinfo[id]', '$realtime')");
						$update_toplvl = mysql_query("update mb_topics set postedat='' where id='$post[under]'");
					}
					$update_user = mysql_query("update userdb set mbposts=mbposts+1 where id='$playerinfo[id]'");
				}else{
					echo "Your done posting for today.";
				}
			}
		}else{
			echo "<BR><BR><BR><center> You cannot post while banned!</center>";
		}
	}
}
$test = mysql_query("UPDATE userdb SET mcheck='$realtime' WHERE id='$playerinfo[id]'");
include("bottom.php");
}
?>

 

any and all help appreciated

 

thank you for your time and help

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.