server load going to 25.00 +

Started on the old forum in October 2009 · view the original in the archive · old links redirect here

17 replies · 1,035 views · started 17 years ago · 1 min read

11 participants
crazybrumi Super moderator Principal · 1,064 posts #1

hi there when people come into the chatrooms the server starts increasing load. i cant see what the issue is but it seems to be only in the chatrooms. could you please have a look here at anything that could may have caused this i have had a look removed parts to try and work out what it oculd be but i have had no luck.

chat.php

<?php
define('WCS',true);
include('../core/main.inc');
header_type();
cleardata();
if(ipbanned(ip(),browser())){
if(!shield(getuid_sid($sid))){
echo head_tag("Ip Blocked!!!",0,0);
echo ipbanned_msg();
echo foot_tag();
exit();
}
}
if(!islogged($sid)){
echo head_tag("Error!!!",0,0);
echo session_expired();
echo foot_tag();
exit();
}
if(banned(getuid_sid($sid))){
echo head_tag("Error!!!",1,getnick_sid($sid));
echo banned_msg($sid);
echo foot_tag();
exit();
}
if(chatbanned(getuid_sid($sid))){
echo head_tag("Error!!!",1,getnick_sid($sid));
echo chatbanned_msg($sid);
echo foot_tag();
exit();
}
mysql_query("UPDATE users SET browser='".browser()."', ipaddress='".ip()."', host='".subno()."' WHERE id='".getuid_sid($sid)."'");

/////////////////////////CHAT/////////////////////////

if($pass!=""){$pw="&pass=$pass";}
$roomname=mysql_fetch_array(mysql_query("SELECT id, name FROM chatrooms WHERE id='".$rid."'"));
$title="<b>".getnick_sid($sid)."@$roomname[1]</b>";
$isroom=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM chatrooms WHERE id='".$rid."'"));
if($isroom[0]==0){
echo head_tag(getnick_sid($sid)."@".$roomname[1],1,getnick_sid($sid));
$main="<p align=".align().">
<b>Room Doesn't Exist</b><br/>
You can't enter this room
</p>\n";
$L1="$sixkey<a $key6 href=\"../inbox/inbox.php?sid=$sid\">Inbox</a>";
$L2="$sevenkey<a $key7 href=\"../buds/buds.php?sid=$sid\">BuddyList</a>";
$L3="$eightkey<a $key8 href=\"./public.php?sid=$sid\">Chatroom</a>";
$L4="$ninekey<a $key9 href=\"../forums/forums.php?sid=$sid\">Forums</a>";
$L5="$zerokey<a $key0 href=\"../main.php?sid=$sid\">Main Menu</a>";
echo xhtml($sid,$title,1,$L1,$L2,$L3,$L4,$L5,0,0,0,$main);
echo foot_tag();
exit;
}

$passworded=mysql_fetch_array(mysql_query("SELECT password FROM chatrooms WHERE id='".$rid."'"));
if($passworded[0]!=""){
if($pass!=$passworded[0]){
echo head_tag(getnick_sid($sid)."@".$roomname[1],1,getnick_sid($sid));
$main="<p align=".align().">
<b>Enter Password!</b>
</p>\n";
$main.="<div class=".align().">
<form action=\"chat.php?sid=$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";
$L1="$sixkey<a $key6 href=\"../inbox/inbox.php?sid=$sid\">Inbox</a>";
$L2="$sevenkey<a $key7 href=\"../buds/buds.php?sid=$sid\">BuddyList</a>";
$L3="$eightkey<a $key8 href=\"./public.php?sid=$sid\">Chatroom</a>";
$L4="$ninekey<a $key9 href=\"../forums/forums.php?sid=$sid\">Forums</a>";
$L5="$zerokey<a $key0 href=\"../main.php?sid=$sid\">Main Menu</a>";
echo xhtml($sid,$title,1,$L1,$L2,$L3,$L4,$L5,0,0,0,$main);
echo foot_tag();
exit;
}
}

if(!canenter(getuid_sid($sid),$rid))
{
echo head_tag(getnick_sid($sid)."@".$roomname[1],1,getnick_sid($sid));
$main="<p align=".align().">
<img src=\"../images/error.gif\" alt=\"[x]\"/><b>Permission denied!</b><br/>
You can't enter this room<br/>
<a $key7 href=\"./public.php?sid=$sid&exit=yes\">Chat Menu</a>
</p>\n";
$L1="$sixkey<a $key6 href=\"../inbox/inbox.php?sid=$sid\">Inbox</a>";
$L2="$sevenkey<a $key7 href=\"../buds/buds.php?sid=$sid\">BuddyList</a>";
$L3="$eightkey<a $key8 href=\"./public.php?sid=$sid\">Chatroom</a>";
$L4="$ninekey<a $key9 href=\"../forums/forums.php?sid=$sid\">Forums</a>";
$L5="$zerokey<a $key0 href=\"../main.php?sid=$sid\">Main Menu</a>";
echo xhtml($sid,$title,1,$L1,$L2,$L3,$L4,$L5,0,0,0,$main);
echo foot_tag();
exit;
}

$age=mysql_fetch_array(mysql_query("SELECT birthday FROM profiles WHERE uid='".getuid_sid($sid)."'"));
$level=mysql_fetch_array(mysql_query("SELECT level FROM users WHERE id='".getuid_sid($sid)."'"));

if(($rid==5)&&($age[0]>17)&&($level[0]<1)){
echo head_tag(getnick_sid($sid)."@".$roomname[1],1,getnick_sid($sid));
$main="<p align=".align().">
<img src=\"../images/error.gif\" alt=\"[x]\"/><b>Permission denied!</b><br/>
You can't enter this room<br/>
<a $key7 href=\"./public.php?sid=$sid&exit=yes\">Chat Menu</a>
</p>\n";
echo xhtml($sid,$title,1,$L1,$L2,$L3,$L4,$L5,0,0,0,$main);
echo foot_tag();
exit;
}

if(($rid==5)&&($age <18)){
echo head_tag(getnick_sid($sid)."@".$roomname[1],1,getnick_sid($sid));
$main="<p align=".align().">
<img src=\"../images/error.gif\" alt=\"[x]\"/><b>Permission denied!</b><br/>
You can't enter this room
</p>\n";
echo xhtml($sid,$title,1,$L1,$L2,$L3,$L4,$L5,0,0,0,$main);
echo foot_tag();
exit;
}

addtochat(getuid_sid($sid),$rid);
$timeto=300;
$timenw=time();
$timeout=$timenw-$timeto;
$deleted=mysql_query("DELETE FROM chat WHERE timesent<".$timeout."");
$rooms=mysql_fetch_array(mysql_query("SELECT id, name FROM chatrooms WHERE id='".$rid."'"));
$rname=$rooms[1];
echo "<head>
<title>".getnick_sid($sid)."@$roomname[1]</title>
<link rel=\"stylesheet\" type=\"text/css\" href=\"../style.php?uid=".getnick_sid($sid)."\"/>\n";
if($count_popup[0]<1){
echo "<meta http-equiv=\"refresh\" content=\"20; url=chat.php?sid=$sid&rid=$rid$pw\"/>\n";
}
echo "</head>
<body>\n";
addonline(getuid_sid($sid),"Chatting In ".$roomname[1],"chat/chat.php?rid=$rid$pw");
if($count_popup[0]>0){
$rname=mysql_fetch_array(mysql_query("SELECT name FROM chatrooms WHERE id='".$rid."'"));
$popsenabled=mysql_fetch_array(mysql_query("SELECT popups FROM users WHERE id='".getuid_sid($sid)."'"));
$pminfo=mysql_fetch_array(mysql_query("SELECT id, text, byid, timesent, toid, reported FROM popups WHERE unread='1' AND toid='".getuid_sid($sid)."'"));
mysql_query("UPDATE popups SET unread='0' WHERE id='".$pminfo[0]."'");
if(isspam($pminfo[1])){mysql_query("UPDATE popups SET reported='1' WHERE id='".$pminfo[0]."'");}
$sex=mysql_fetch_array(mysql_query("SELECT sex, image FROM profiles WHERE uid='".$pminfo[2]."'"));
if($sex[0]=="M"){$color="#0000FF";}
if($sex[0]=="F"){$color="#FF0066";}
if($sex[1]!=""){$usersex=getbbcode($sex[1],$sid,1);}
$main.="<div class=\"left\">
<b>Popup Message<br/>
From $usersex<span style=\"color:$color;\">".getnick_uid($pminfo[2])."</span></b><br/>
<small>(".date("H:i-D jS M y",$pminfo[3]).")</small><br/>\n";
$main.=getbbcode($pminfo[1],$sid,1)."
<form action=\"../popups.php?send=1&who=$pminfo[2]&msgid=$pminfo[0]&sid=$sid\" method=\"post\">
<b>Reply</b><br/>
<input name=\"message\" maxlength=\"500\"/><br/>
<input type=\"submit\" value=\"Send\"/>
</form>";
$main.="<a href=\"./chat.php?rid=$rid&sid=$sid$pw\">Skip Msg</a>\n";
//$main.="<a href=\"inbxproc.php?action=rptpop&sid=$sid&pmid=$pminfo[0]\">Report</a><br/>";
$main.="</div>\n";
}
$main.="$onekey<a $key1 name=\"top\" id=\"top\" href=\"write.php?sid=$sid&rid=$rid$pw\">Write</a><br/>\n";
$unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM inbox WHERE unread='1' AND toid='".getuid_sid($sid)."'"));
$unrd="".$unreadinbox[0]."";
if($unreadinbox[0]>0){
$inbox="Inboxes";
if($unreadinbox[0]==1)$inbox="Inbox";
$main.="$fivekey<a $key5 href=\"../inbox/inbox.php?sid=$sid&rid=$rid$pw\">$unrd New $inbox!</a><br/>\n";
}
$main.="$Skey<a $keyS href=\"./chat.php?sid=$sid&rid=$rid$pw\">Refresh</a><br/>\n";

$level=mysql_fetch_array(mysql_query("SELECT level FROM users WHERE id='".getuid_sid($sid)."'"));

$message=$_POST["message"];
$who=$_POST["who"];
$rinfo=mysql_fetch_array(mysql_query("SELECT censored, freaky FROM chatrooms WHERE id='".$rid."'"));
if(trim($message)!=""){
if(!blocked_site($message,getuid_sid($sid)))
{
if($to_user=="*")$to_user="";
$chatok=mysql_query("INSERT INTO chat SET uid='".getuid_sid($sid)."', toid='".$to_user."', timesent='".time()."', text='".$message."', rid='".$rid."'");
$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)."'");
$lstmsg=mysql_query("UPDATE chatrooms SET lastmsg='".time()."' WHERE id='".$rid."'");
$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)."'");
$clubid=mysql_fetch_array(mysql_query("SELECT clubid FROM chatrooms WHERE id='".$rid."'"));
$pts=mysql_fetch_array(mysql_query("SELECT points FROM clubs WHERE id='".$clubid[0]."'"));
if($clubid[0]!=0){mysql_query("UPDATE clubs SET points='".($pts[0]+1)."' WHERE id='".$clubid[0]."'");}
}else{
$bantime=time()+(30*24*60*60);
$main.="<img src=\"http://coding-talk.com/images/notok.gif\" alt=\"X\"/><br/>Can't Post Msg<br/>
You just tried sending a msg with a link to one of the crapiest sites on earth<br/>
The members of these sites spam here a lot, so go to that site and stay there if you don't like it here<br/>
as a result of your stupid action:<br/>
1. you have lost your sheild<br/>
2. you have lost all your plusses<br/>
3. You are BANNED!";
mysql_query("INSERT INTO logs SET action='autoban', details='<b>".getnick_uid(1)."</b> auto banned ".getnick_sid($sid)." for spamming chat', date='".time()."'");
mysql_query("INSERT INTO banned SET uid='".getuid_sid($sid)."', penalty='3', byid='1', remaining='".$bantime."', reason='Banned: Automatic Ban for spamming for a crap site'");
mysql_query("UPDATE profiles SET points='0', WHERE uid='".getuid_sid($sid)."'");
mysql_query("INSERT INTO inbox SET text='[B](forwarded spam via chat)[/B][br/]".$message."', byid='".getuid_sid($sid)."', toid='1', reported='1', timesent='".time()."'");
echo xhtml($sid,$title,0,0,0,0,0,0,0,0,0,$main);
echo foot_tag();
exit;
}
if($rinfo[1]==2){
$botid="eeb070e74e366473";
$hostname="www.pandorabots.com";
$hostpath="/pandora/talk-xml";
$sendData="botid=".$botid."&input=".urlencode($message)."&custid=".$custid;
$result=PostToHost($hostname, $hostpath, $sendData);
$pos=strpos($result, "custid=\"");
$pos=strpos($result, "<that>");
if($pos===false){$reply="";}
else{
$pos+=6;
$endpos=strpos($result, "</that>", $pos);
$reply=substr($result, $pos, $endpos - $pos);
$reply=mysql_escape_string($reply);
}
$chatok=mysql_query("INSERT INTO chat SET uid='1', toid='', timesent='".time()."', text='".$reply." @".getnick_uid(getuid_sid($sid))."', rid='".$rid."';");
}
$message="";
}
$main.="<p>\n";
$chats=mysql_query("SELECT uid, toid, timesent, text, exposed FROM chat WHERE rid='".$rid."' ORDER BY timesent DESC, id DESC");
$counter=0;
while($chat=mysql_fetch_array($chats)){
$canc=true;
if($counter<40){
/*if(ignored($chat[0],getuid_sid($sid))){$canc=false;}*/
if($chat[0]!=getuid_sid($sid)){
if($chat[1]!=0){
if($chat[1]!=getuid_sid($sid)){$canc=false;}
}
}
if(($chat[4]=='1')&&(ismod(getuid_sid($sid))||isadmin(getuid_sid($sid))||isheadadmin(getuid_sid($sid))||isowner(getuid_sid($sid)))){$canc=true;}
if($canc){
$sex=mysql_fetch_array(mysql_query("SELECT sex, image FROM profiles WHERE uid='$chat[0]'"));
if($sex[0]=="M"){$color=" style=\"color:#0000FF\"";}
if($sex[0]=="F"){$color=" style=\"color:#FF0066\"";}
if($sex[0]==""){$usersex="";}
if($sex[1]!=""){$usersex=getbbcode($sex[1],$sid,1);}
$chnick=getnick_uid($chat[0]);
$optlink=$usersex.$chnick;
if(($chat[1]!=0)&&($chat[0]==getuid_sid($sid))){$optlink="<img src=\"../images/out.gif\" alt=\"!\"/>Pm To ".getnick_uid($chat[1])."";}
if($chat[1]==getuid_sid($sid)){$optlink="<img src=\"../images/in.gif\" alt=\"!\"/>Pm By ".getnick_uid($chat[0])."";}
if($chat[4]=='1'){$optlink="<img src=\"../images/point.gif\" alt=\"!\"/>".getnick_uid($chat[0])."<img src=\"../images/in.gif\" alt=\"!\"/>".getnick_uid($chat[1])."";}
if(isspam(getbbcode($chat[3],$sid,1))){$main.="<b>Chat System»<i>*oi! ".getnick_uid($chat[0]).", no spamming*</i></b><br/>";}
else if(substr_count(getbbcode($chat[3],$sid,1),"<img src=")>4){$main.="<b>Chat System»<i>*hey! ".getnick_uid($chat[0]).", you can only use 4 smilies per msg*</i></b><br/>";}
else{
$flood=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM chat WHERE text='".htmlspecialchars($chat[3],ENT_QUOTES)."' AND uid='".$chat[0]."'"));
if(substr($chat[3],0,3)=="/me"){$main.="<b>$chnick»<i>*".getbbcode(substr($chat[3],4,strlen($chat[3])-3),$sid,1)."*</i></b><br/>";}
else if($flood[0]>5){$main.="<b>Chat System»<i>*hey! ".getnick_uid($chat[0]).", U Cannot Flood This Room!*</i></b><br/>";
$points=mysql_fetch_array(mysql_query("SELECT points FROM profiles WHERE uid='".$chat[0]."'"));
$update=$points[0]-1;
$point=mysql_query("UPDATE profiles SET points='".$update."' WHERE uid='".$chat[0]."'");
mysql_query("DELETE FROM chat WHERE text='".$chat[3]."' AND uid='$chat[0]' LIMIT 1");
}
else if($chat[3]!=""){
if($rinfo[0]==0){$tosay=getbbcode($chat[3],$sid,0);}
else{$tosay=getbbcode($chat[3],$sid,1);}
if($rinfo[1]==1){$tosay=strrev($tosay);}
$main.="<a href=\"./pm.php?who=$chat[0]&sid=$sid&rid=$rid$pw\"$color>$optlink</a> - $tosay<br/>\n";
}
}
$counter++;
}
}
}
$main.="</p>
$onekey<a $key1 href=\"./write.php?sid=$sid&rid=$rid$pw\">Write</a><br/>
$twokey<a $key3 href=\"./settings.php?sid=$sid&rid=$rid$pw\">Settings</a><br/>";
$chatters=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM chatonline where rid='".$rid."'"));
$main.="$threekey<a $key4 href=\"./inside.php?sid=$sid&rid=$rid$pw\">Inside $chatters[0]</a><br/>
$fourkey<a $key7 href=\"./public.php?sid=$sid&exit=yes\">Chat Menu</a><br/>
$fivekey<a $key8 href=\"../forums/forums.php?sid=$sid\">Forums</a><br/>
$ninekey<a $key9 href=\"#top\">Top</a> | 
$zerokey<a $key0 href=\"../main.php?sid=$sid\">Main Menu</a><br/>";
echo xhtml($sid,$title,0,0,0,0,0,0,0,0,0,$main);
echo foot_tag();
?>

and write.php

<?php
define('WCS',true);
include('../core/main.inc');
header_type();
cleardata();
if(ipbanned(ip(),browser())){
if(!shield(getuid_sid($sid))){
echo head_tag("Ip Blocked!!!",0,0);
echo ipbanned_msg();
echo foot_tag();
exit();
}
}
if(!islogged($sid)){
echo head_tag("Error!!!",0,0);
echo session_expired();
echo foot_tag();
exit();
}
if(banned(getuid_sid($sid))){
echo head_tag("Error!!!",1,getnick_sid($sid));
echo banned_msg($sid);
echo foot_tag();
exit();
}
if(chatbanned(getuid_sid($sid))){
echo head_tag("Error!!!",1,getnick_sid($sid));
echo chatbanned_msg($sid);
echo foot_tag();
exit();
}
mysql_query("UPDATE users SET browser='".browser()."', ipaddress='".ip()."', host='".subno()."' WHERE id='".getuid_sid($sid)."'");

/////////////////////////WRITE CHAT MSG/////////////////////////

if($pass!=""){$pw="&pass=$pass";}
$roomname=mysql_fetch_array(mysql_query("SELECT id, name FROM chatrooms WHERE id='".$rid."'"));
addonline(getuid_sid($sid),"Writing Chat Msg","chat.php?action=$action&rid=$rid$pass");
echo head_tag(getnick_sid($sid)."@Writing Chat Msg",1,getnick_sid($sid));
$title="<b>Writing Chat Msg</b>";

$validated=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM users WHERE id=".getuid_sid($sid)." AND validated=0 "));
if($validated[0]>0){
$main.="<br/><img src=\"../images/error.gif\" alt=\"\"/><b>Your Account Is Being Validated By One Of Our Admins Please give us up to 20 Minutes to validate you</b><br/>";
$L1="$sixkey<a $key6 href=\"../inbox/inbox.php?sid=$sid\">Inbox</a>";
$L2="$sevenkey<a $key7 href=\"../buds/buds.php?sid=$sid\">BuddyList</a>";
$L3="$eightkey<a $key8 href=\"../chat/public.php?sid=$sid\">Chat</a>";
$L4="$ninekey<a $key9 href=\"../forums/forums.php?sid=$sid\">Forums</a>";
$L5="$zerokey<a $key0 href=\"../main.php?sid=$sid\">Main Menu</a>";
echo xhtml($sid,$title,1,$L1,$L2,$L3,$L4,$L5,0,0,0,$main);
echo foot_tag();
exit();

}

$main="<div class=".align().">
<form action=\"chat.php?sid=$sid&rid=$rid$pw\" method=\"post\">
<b>Message:</b><br/>
<input name=\"message\" type=\"text\" maxlength=\"500\"/><br/>
<b>To:</b><br/>
<select name=\"to_user\">
<option value=\"*\">All</option>\n";
$query="select uid from chatonline where rid='".$rid."' and uid!='".getuid_sid($sid)."'";
$result=mysql_query($query);
while($row_chat=mysql_fetch_array($result)){
$nick=getnick_uid($row_chat["uid"]);
$main.="<option value=\"".$row_chat["uid"]."\">$nick</option>\n";
}
$main.="</select>
<input type=\"submit\" value=\"Send!\"/>
</form>
</div>\n";
$main.="<p align=".align().">\n$fivekey<a $key5 href=\"chat.php?sid=$sid&rid=$rid$pw\">Back To $roomname[1]</a>\n</p>\n";
$L1="$sixkey<a $key6 href=\"../inbox/inbox.php?sid=$sid\">Inbox</a>";
$L2="$sevenkey<a $key7 href=\"../buds/buds.php?sid=$sid\">BuddyList</a>";
$L3="$eightkey<a $key8 href=\"./public.php?sid=$sid\">Chat</a>";
$L4="$ninekey<a $key9 href=\"../forums/forums.php?sid=$sid\">Forums</a>";
$L5="$zerokey<a $key0 href=\"../main.php?sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Main Menu</a>";
echo xhtml($sid,$title,1,$L1,$L2,$L3,$L4,$L5,0,0,0,$main);
echo foot_tag();
?>

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

WhiteWarrior Principal · 1,419 posts #2

There are too many mysql_query's going on at once, and its trying to read too many other pages at the same timeif you know what i mean.. i aint ever used that aftadark script before so i dont know whats in the other folders/files what its trying to read.. but what i said above could be a reason..

try it on another server and see what happens.

crazybrumi Super moderator Principal · 1,064 posts #3

like i said garry i have removed things by debugging and seing what the issue was but it hasnt come up any good. if removed bits of coding etc but hasnt helped i even removed anything that wasnt really needed from other pages and it still was doing the same. iv recently moved from a dual core dedicated server to a brand new quad-core dedicated but its still same issue. if it was the server it would have laod 247 but even with ova 100 sites and a few sites with 20+ people on all the time when noones in the chatrooms my load is only 0.5-1.0

Want something coded email me at sales@webnwaphost.com for a prices.

http://flagcounter.com/more/W80q

syrus Junior · 44 posts #4

crazybrumi wrote: like i said garry i have removed things by debugging and seing what the issue was but it hasnt come up any good. if removed bits of coding etc but hasnt helped i even removed anything that wasnt really needed from other pages and it still was doing the same. iv recently moved from a dual core dedicated server to a brand new quad-core dedicated but its still same issue. if it was the server it would have laod 247 but even with ova 100 sites and a few sites with 20+ people on all the time when noones in the chatrooms my load is only 0.5-1.0

ah yes another badly written edit/script

kiss of death Developer · 54 posts #5

crazybrumi iam sure it not script problem may due to maxclient issue in http.conf file

can copy the top -c command here or PM me i wil help you

i haveing 3 years of linux server knowledge

Hostxweb Hosting99.9% uptime Shared Hosting, Reseller Hosting CPanel Hosting • Offsite-Backup • Great Uptime India's No1 Wap Site

mentalhosting Junior · 19 posts #6

how do u now the load time on this script brummi have you got coding so i cam add it on me site please

ori Lead · 512 posts #9

most those quieries are called when there needed i dont see anything runnng that shouldnt my server went ok on that script never went over 5% and was running 60 sites

ewanz Developer · 187 posts #10

i have the probs same too... the cpu and memory usage are overload... that was make im bored to expand my script... maybe i must reduce same modules...

our lfe is simple words.... 😌 http://mygenkz.net ewanz06@yahoo.com

$output="i am NOoob....";
$newfile="ewanz.txt";
$file = fopen ($newfile, "w");
fwrite($file, $output);
fclose ($file); 
morse Senior · 364 posts #11

Very old topic bumped ! Kinda relevant to my current situation, site keeps on crashing again and again and again!! Chatrooms are quite a pain in the azz !!

tinyurl.com/earnbymobile Easy earning for Indians

Alternative mobile advertising network .. Minimum 100 USD pay / NET15 pay cycle, Good Brand, Best targeting for Android goo.gl/6vub3

GumSlone Administrator Principal · 1,690 posts #12

morse wrote: Very old topic bumped ! Kinda relevant to my current situation, site keeps on crashing again and again and again!! Chatrooms are quite a pain in the azz !!

what type of chat are you using?, check how many mysql queries are in the chatroom?

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

antony2kx Developer · 94 posts #13

I think maybe it can be the connection to the database, maybe too many connections are created, you should try the singleton programming approach, please revise your script make sure only one database connection is present per session for each user, that maybe, or as GumSlone said, it can be the queries. too many at once, i may presume, please check these things

something else Fellow · 2,296 posts #14

for a quick fix you could try a persistent connection

mysql_pconnect ()

🙂

GumSlone Administrator Principal · 1,690 posts #15

i had a similar problem in the past wit a chat site, to solve it i made a cron job which deletes all chatroom messages older than 15 minutes, also i removed mysql queries which are not important for chatroom like inbox check if there are new messages.

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

morse Senior · 364 posts #16

GumSlone wrote: what type of chat are you using?, check how many mysql queries are in the chatroom?

Its a self setup chat script, its not similar to any over here. 24 sql queries on page. 4 queries i.e. ban check, ip ban check, trash check and ignore check are persistent. Out of the rest, action based query, room list query, inbox query, message querry, room name query and chat message limit query. So in total 10 or 14 mysql database queries per page load!

antony2kx wrote: I think maybe it can be the connection to the database, maybe too many connections are created, you should try the singleton programming approach, please revise your script make sure only one database connection is present per session for each user, that maybe, or as GumSlone said, it can be the queries. too many at once, i may presume, please check these things

Singleton approach cannot help, I need parallel processing.

something else wrote: for a quick fix you could try a persistent connection

mysql_pconnect ()

:)

Done 🙂 saw it mentioned somewhere by you, so had applied it then and there itself.

GumSlone wrote: i had a similar problem in the past wit a chat site, to solve it i made a cron job which deletes all chatroom messages older than 15 minutes, also i removed mysql queries which are not important for chatroom like inbox check if there are new messages.

Bang on Target! I preserve chat posts for 7 days. The users want a leader board feature, they wish to outsmart each other in terms of chat posts they make in a week. In a way am torn apart between users demands and server capabilities. To top it all there is this certain section of religious fanatics who take away my users in the name of religion just coz am liberal and allow for anything. Anyways bringing that topic on here would be personal talk. I guess i will have to choose between server capability and user demand, as both cannot be served.

tinyurl.com/earnbymobile Easy earning for Indians

Alternative mobile advertising network .. Minimum 100 USD pay / NET15 pay cycle, Good Brand, Best targeting for Android goo.gl/6vub3

GumSlone Administrator Principal · 1,690 posts #17

and make for chatroom just few mysql queries, because chatrooms with autorefresh are most active part of your site and use most of your server ressources, and you don't need the ban check or ip check query in the chatroom inside, put this on the page where user has to write a message.

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

something else Fellow · 2,296 posts #18

remember if you use mysql_pconnect () make sure you remove mysql_close () as it will cause errors ..

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close