Jump to content
MakeWebGames

Shoutbox is evil! Need alternative


Recommended Posts

Posted

All right last couple days my hosting account has been getting temporary disabled due to hru(High Resource Usage) i just couldnt figure it out, i made a crappy low quality layout, used external cron jobs and etc but they kept shutting me down saying i reach the resources limit -_- so i decided to disbaled shoutbox.php and sure nuff no more hru problems ^^ BUT now i have to global way for my players to chat with each other =/ anybody know any alternative mccodes chat like system because shoutbox screwed me over.

If anybody was curious here is the code

<?php
session_start();
include "globals.php";
?>
<style>
body {
background-color: black;
  scrollbar-base-color: white
  scrollbar-arrow-color: #000000;
  scrollbar-DarkShadow-Color: #000000;
  bgbackground: black;
  bgcolor: black;  }
a:visited,a:active,a:hover,a:link { color:white;text-decoration: none; }
table,tr,td { font-size: 11.1; }
img { border:none; }
.button
{
font-family:helvetica, arial, geneva, sans-serif;
font-size:12;
color:#000000;
background-color: white;
}

input,textarea,dropdown{
font-family:helvetica, arial, geneva, sans-serif;
font-size:12;
color:#000000;
background-color: white;
border: 1px solid;
}

textarea,.submit input{
font-family:helvetica, arial, geneva, sans-serif;font-size:12;color:#000000;
}
textarea { font-family:helvetica, arial, geneva, sans-serif;font-size:11;color: #000000; }
a:hover { color: blue;text-decoration: blink; text-decoration: underline; background: none; }
</style>

<center>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">-> <b>Refresh Shout Box</b> <-</a>
<?php
if($ir['user_level']>1)
{
echo"<br><a href='?action=banlist'>-> <b>Ban List</b> <-</a>";
}
?>
<br><a href='?action=shoutbox'></a>
</center>
<?php
if($ir['banshout']==1)
{
echo"You cannot access the shout box while being banned.";
exit;
}
if($_GET['action']==del)
{
if($ir['user_level']>1)
{
$id=$_GET['id'];
$db->query("DELETE FROM shoutbox WHERE id='{$id}'") or die(mysql_error());
echo"";
}
else
{
echo"";
}
}
if($_GET['action']==shoutbox)
{
global $ir,$c,$userid,$h;
echo "Your Shoutbox is now ";
if($ir['shoutbox']==1)
{
echo "hidden";
$db->query("UPDATE users SET shoutbox=0 WHERE userid=$userid",$c);
}
if($ir['shoutbox']==0)
{
echo "showing";
$db->query("UPDATE users SET shoutbox=1 WHERE userid=$userid",$c);
}
exit;
}
if($_GET['action']==ban)
{
if($ir['user_level']>1)
{
$id=$_GET['id'];
$db->query("UPDATE users SET banshout=1 WHERE userid='{$id}'") or die(mysql_error());
echo"";
}
else
{
echo"";
}
}
if($_GET['action']==banlist)
{
echo"<table border=1 width=50%><th>User</th><th>Actions</th><tr>";
$d=$db->query("SELECT * FROM users WHERE banshout=1") or die(mysql_error());
while($t=$db->fetch_row($d))
{
echo"<td>{$t['username']}</td><td><a href='?action=unban&id={$t['userid']}'>Unban</td><tr>";
}
echo"</table>";
exit;
}
if($_GET['action']==unban)
{
if($ir['user_level']>1)
{
$id=$_GET['id'];
$db->query("UPDATE users SET banshout=0 WHERE userid='{$id}'") or die(mysql_error());
echo"";
}
else
{
echo"";
}
}
if ($_GET['action']=='1') {
$newmsg = strip_tags($_POST['msg'],"");
$string = "$newmsg";
$search = array(
  ':behind:',
  ':tagteam:',
  ':blow:',
  ':smack:',
  ':bumsmack:',
  ':whip:',
  ':69:',
  ':kiss:',
  ':wedgie:',
  ':]',
  ':D',
  ':oo:',
  'O.o',
  ':/',
  ':angry:',
  ':?:',
  ':lol:',
  ':-:',
  ':O',
  ':(',
  'O.O',
  ':roll:',
  ':zzz:',
  ':)',
  ':P',
  ':S',
  ':nut:',
  ';)',
  ':heart:',
  'XD',
  '[b]',
  '[/b]',
  '[i]',
  '[/i]',
  '[u]',
  '[/u]',
  '[s]',
  '[/s]',
  '[url',
  '[',
  ']',
  '/url',
  '[font color',
  '[/font]',
  '[right]',
  '/right',
  '[center]',
  '/center',
  '[left]',
  '/left',
  '
'
);

$replace = array(
  '<img src="/images/smileys/fuckher.gif">',
  '<img src="/images/smileys/tagteam.gif">',
  '<img src="/images/smileys/blowme.gif">',
  '<img src="/images/smileys/slap.gif">',
  '<img src="/images/smileys/smiley_ass.gif">',
  '<img src="/images/smileys/whip.gif">',
  '<img src="/images/smileys/69.gif">',
  '<img src="/images/smileys/kiss.gif">',
  '<img src="/images/smileys/wedgie.gif">',
  '<img src="/images/happy.gif">',
  '<img src="/images/biggrin.gif">',
  '<img src="/images/cool.gif">',
  '<img src="/images/blink.gif">',
  '<img src="/images/dry.gif">',
  '<img src="/images/angry.gif">',
  '<img src="/images/huh.gif">',
  '<img src="/images/laugh.gif">',
  '<img src="/images/mellow.gif">',
  '<img src="/images/ohmy.gif">',
  '<img src="/images/sad.gif">',
  '<img src="/images/ph34r.gif">',
  '<img src="/images/rolleyes.gif">',
  '<img src="/images/sleep.gif">',
  '<img src="/images/smile.gif">',
  '<img src="/images/tongue.gif">',
  '<img src="/images/unsure.gif">',
  '<img src="/images/wacko.gif">',
  '<img src="/images/wink.gif">',
  '<img src="/images/wub.gif">',
  '<img src="/images/XD.gif">',
  ' <b>',
  '</b>',
  ' <i>',
  '</i>',
  ' <u>',
  '</u>',
  ' <s>',
  '</s>',
  '<a href',
  '<',
  '>',
  '/a',
  '<font color',
  '/font',
  '<font align=right>',
  '/font',
  '<font align=center>',
  '/font',
  '<font align=left>',
  '/font',
  '<br>'
);

$new_string = str_replace($replace, $search, $string);

$new_string = str_replace($search, $replace, $string);
print "</form>";

if ($_POST['msg']) {
               $starter = "<font color=white>{$ir['username']}</font>";
                if ($ir['userid']==1) {
		$starter = "<font color=purple>{$ir['username']}</font>";
              }
                if ($ir['title']=='Captain') {
		$starter = "<font color=blue>{$ir['username']}</font>";
              }
                if ($ir['title']=='Lieutenant') {
		$starter = "<font color=red>{$ir['username']}</font>";
              }
                 if ($ir['race']=='Hollow') {
		$starter = "<font color=black>{$ir['username']}</font>";
              }
$id=$ir['userid'];
$db->query("INSERT INTO shoutbox VALUES ('', unix_timestamp(),'<a href=user.php?ID=$id target=_blank>$starter</a>','$userid', '$new_string')");
}
}


$bk = $db->query("select * from shoutbox order by id desc limit 15");
while ($chat = $db->fetch_row($bk))
{
$time=date('g:i a',$chat['time']);
print "</center>";
if($ir['user_level']>1){echo"<a href='?action=del&id={$chat['id']}'><font color=red>[D]</font></a><a href='?action=ban&id={$chat[userid]}'><font color=lime>[b]</font></a>";}echo"<font color=990099>[$time]</font></b><b>$chat[user]</b></font></font></font></font></a></a></a></a></a><font color=red>:</font> <font color=white>$chat[chat]</font><br>";
}
?>
<center>
<form method=post action=shoutbox.php?action=1>
<font color=white>Enter Message:</font> <input type=text name=msg size=20><br />
</form>
</center>
</body>

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.   Paste as plain text instead

  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...