These 3 lines could have been called all at once rather than 3 seperate calls to db
PHP Code:
$rooms=mysql_fetch_array(mysql_query("SELECT id, name FROM chatrooms WHERE id='".$rid."'"));
$rname=mysql_fetch_array(mysql_query("SELECT name FROM chatrooms WHERE id='".$rid."'"));
$rinfo=mysql_fetch_array(mysql_query("SELECT censored, freaky FROM chatrooms WHERE id='".$rid."'"));
PHP Code:
$points=mysql_fetch_array(mysql_query("SELECT points FROM profiles WHERE uid='".getuid_sid($sid)."'"));
$update=$points[0]+1;
$point=mysql_query("UPDATE profiles SET points='".$update."' WHERE uid='".getuid_sid($sid)."'");
$hehe=mysql_fetch_array(mysql_query("SELECT chatmsgs FROM profiles WHERE uid='".getuid_sid($sid)."'"));
$totl=$hehe[0]+1;
$msgst=mysql_query("UPDATE profiles SET chatmsgs='".$totl."' WHERE uid='".getuid_sid($sid)."'");
PHP Code:
mysql_query("UPDATE profiles SET chatmsgs=chatmsg+1, points=points+1 WHERE uid='".getuid_sid($sid)."'");
PHP Code:
echo"<div class=\"left\">
<form action=\"chat.php?sid=<?php echo($sid) ?>&rid=$roomname[0]\" method=\"post\">
<b>Room Name:</b><br/>$roomname[1]<br/>
<b>Password:</b><br/><input name=\"pass\" maxlength=\"10\"/><br/>
<input type=\"submit\" Value=\"Enter\"/>
</form>
</div>\n";
PHP Code:
form action=\"chat.php?sid=<?php echo($sid) ?>&rid=$roomname[0]\" method=\"post\">
and also possibly cut down on more echo`s (even tho a lot of them are removed already) eg:
change:
PHP Code:
?><div class="div">Welcome to <?php echo($roomname[1])?> Chatroom</div><?php
PHP Code:
?><div class="div">Welcome to <?=$roomname[1]?> Chatroom</div><?php
Leave a comment: