chat
Fatal error: Maximum execution time of 30 seconds exceeded in d:\appserv\www\chat.php on line 107
106: sleep(1);
107: flush();
kan iemand helpe??
Waarschijnlijk ergens een oneindige loop? post je script eens
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?
mysql_pconnect("localhost","root","");
function sql_query($query) {
return mysql_db_query("chat",$query);
}
if($action == "output") {
$now = gmdate("D, d M Y H:i:s")." GMT";
Header("Date: $now");
Header("Expires: $now");
Header("Last-Modified: $now");
Header("Pragma: no-cache");
Header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate");
Header("Content-Type: text/html");
// join message
$query = "INSERT INTO chat_mesages (nick, message, room, stamp) VALUES ('BEHEER', '$nick komt chat kamer binnen', '$room', '$stamp')";
$result = sql_query($query);
// read messages
$query = "SELECT * FROM chat_mesages WHERE room = '$room' ORDER BY id";
$result = sql_query($query);
// write page
?>
mysql_pconnect("localhost","root","");
function sql_query($query) {
return mysql_db_query("chat",$query);
}
if($action == "output") {
$now = gmdate("D, d M Y H:i:s")." GMT";
Header("Date: $now");
Header("Expires: $now");
Header("Last-Modified: $now");
Header("Pragma: no-cache");
Header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate");
Header("Content-Type: text/html");
// join message
$query = "INSERT INTO chat_mesages (nick, message, room, stamp) VALUES ('BEHEER', '$nick komt chat kamer binnen', '$room', '$stamp')";
$result = sql_query($query);
// read messages
$query = "SELECT * FROM chat_mesages WHERE room = '$room' ORDER BY id";
$result = sql_query($query);
// write page
?>
<HTML>
<HEAD>
<TITLE>Chat!</TITLE>
</HEAD>
<BODY BGCOLOR="#D6E7F7" TEXT="#000000" LINK="#000000" ALINK="#000000" VLINK="#000000" TOPMARGIN="2" LEFTMARGIN="2" MARGINWIDTH="2" MARGINHEIGHT="2">
<SCRIPT LANGUAGE="JavaScript">
<!--
var speed=2000000
var currentpos=0,alt=0,curpos1=0,curpos2=-1
startit()
function scrollwindow() {
if (document.all)
temp=document.body.scrollTop
else
temp=window.pageYOffset
if (alt==0)
curpos1=temp
else
curpos2=temp
if (curpos1!=curpos2) {
if (document.all)
currentpos=document.body.scrollTop+speed
else
currentpos=window.pageYOffset+speed
window.scroll(0,currentpos)
}
else{
currentpos=0
window.scroll(0,currentpos)
}
}
function startit() {
setInterval("scrollwindow()",10)
}
-->
</SCRIPT>
<FONT FONT="arial" SIZE="2">
Code (php)
1
2
3
4
2
3
4
<?
while($record = mysql_fetch_object($result)) {
$message = url($record->message);
?>
while($record = mysql_fetch_object($result)) {
$message = url($record->message);
?>
<> <BR>
Code (php)
<<B>BEHEER</B>> Er is te lang geen bericht geplaatst, <A HREF="#" onclick="location.reload()">herlaad</A> a.u.b.<BR>
</FONT>
</BODY>
</HTML>
<!-- -->
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
<?
$i = 0;
}
sleep(1);
flush();
$query = "SELECT * FROM chat_mesages WHERE room = '$room' AND id > '$id'";
$result = sql_query($query);
$number = mysql_num_rows($result);
if($number > 0) {
while($record = mysql_fetch_object($result)) {
$message = url($record->message);
?>
$i = 0;
}
sleep(1);
flush();
$query = "SELECT * FROM chat_mesages WHERE room = '$room' AND id > '$id'";
$result = sql_query($query);
$number = mysql_num_rows($result);
if($number > 0) {
while($record = mysql_fetch_object($result)) {
$message = url($record->message);
?>
<> <BR>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?
$id = $record->id;
}
$i = 0;
$n = 0;
}
}
}
elseif($action == "input") {
if(!empty($message) && $new == 1) {
// check number of messages
$query = "SELECT * FROM chat_mesages WHERE room = '$room'";
$result = sql_query($query);
$number = mysql_num_rows($result);
// delete message
if($number > 25) {
$query = "SELECT * FROM chat_mesages WHERE room = '$room' ORDER BY id DESC LIMIT 25, 1";
$result = sql_query($query);
$record = mysql_fetch_object($result);
$temp_id = $record->id;
$query = "DELETE FROM chat_mesages WHERE id < $temp_id";
$result = sql_query($query);
}
// add message
$query = "INSERT INTO chat_mesages (nick, message, room, stamp) VALUES ('$nick', '$message', '$room', '$stamp')";
$result = sql_query($query);
}
?>
$id = $record->id;
}
$i = 0;
$n = 0;
}
}
}
elseif($action == "input") {
if(!empty($message) && $new == 1) {
// check number of messages
$query = "SELECT * FROM chat_mesages WHERE room = '$room'";
$result = sql_query($query);
$number = mysql_num_rows($result);
// delete message
if($number > 25) {
$query = "SELECT * FROM chat_mesages WHERE room = '$room' ORDER BY id DESC LIMIT 25, 1";
$result = sql_query($query);
$record = mysql_fetch_object($result);
$temp_id = $record->id;
$query = "DELETE FROM chat_mesages WHERE id < $temp_id";
$result = sql_query($query);
}
// add message
$query = "INSERT INTO chat_mesages (nick, message, room, stamp) VALUES ('$nick', '$message', '$room', '$stamp')";
$result = sql_query($query);
}
?>
<HTML>
<HEAD>
<TITLE>Chat</TITLE>
</HEAD>
<BODY BGCOLOR="#D6E7F7" TEXT="#000000" LINK="#000000" ALINK="#000000" VLINK="#000000" TOPMARGIN="2" LEFTMARGIN="2" MARGINWIDTH="2" MARGINHEIGHT="2">
<FONT FONT="arial" SIZE="2">
<FORM NAME="input" METHOD="post" ACTION="chat.php?action=input" TARGET="input">
<INPUT TYPE="hidden" NAME="new" VALUE="1">
Bericht: <INPUT TYPE="text" NAME="message" SIZE="50" MAXLENGTH="250">
<INPUT TYPE="submit" VALUE="Verstuur">
</FORM>
</FONT>
<SCRIPT LANGUAGE=JavaScript>
<!--
setTimeout("input.message.focus()")
//-->
</SCRIPT>
</BODY>
</HTML>
<FONT FONT="arial" SIZE="2"><P ALIGN="justify">
<ILAYER ID="output" VISIBILITY="hide" WIDTH="100%" HEIGHT="300"></ILAYER><NOLAYER><IFRAME NAME="output" SRC="chat.php?action=output" BORDER="0" VSPACE="0" HSPACE="0" WIDTH="100%" HEIGHT="300" SCROLLING="no" FRAMEBORDER="0" MARGINWIDTH="0" MARGINHEIGHT="0"></A></IFRAME></NOLAYER><LAYER SRC="site:Frontpage&width=100%&height=300" VISIBILITY="hide" onLoad="moveToAbsolute(advertiser.pageX,advertiser.pageY);clip.height=300;clip.width=100%;visibility='show';"></LAYER>
<ILAYER ID="input" VISIBILITY="hide" WIDTH="500" HEIGHT="30"></ILAYER><NOLAYER><IFRAME NAME="input" SRC="chat.php?action=input" BORDER="0" VSPACE="0" HSPACE="0" WIDTH="500" HEIGHT="30" SCROLLING="no" FRAMEBORDER="0" MARGINWIDTH="0" MARGINHEIGHT="0"></A></IFRAME></NOLAYER><LAYER SRC="site:Frontpage&width=500&height=30" VISIBILITY="hide" onLoad="moveToAbsolute(advertiser.pageX,advertiser.pageY);clip.height=30;clip.width=500;visibility='show';"></LAYER>
</P></FONT>
ripped from phpfreakz haha
:/ ik denk dat het daar in zit maar wat daarvoor in de plaats zou moeten komen weet ik niet. staat er ook niks bij commentaar bij dat script op phpfreakz?
het lijkt me makkelijker om daar te reageren zodat de maker je zelf kan helpen
die zal het script vast beter kennen dan wij
enne ik zou proberen om bovenaan het bestand te zetten
Jah das waar maar als ik daar reageer krijg ik geen antwoord terug daarom vraag ik het hier maar snap...
weet iemand mischien hoe ik een soort goto kan make met functions?????