Maximum execution time exceeded.

Reply

Join Date: Jan 2005
Posts: 23
Reputation: Khishin is an unknown quantity at this point 
Solved Threads: 0
Khishin Khishin is offline Offline
Newbie Poster

Maximum execution time exceeded.

 
0
  #1
Oct 19th, 2005
Two questions here, the first is whether the following error refers to the command exceeding 60 seconds or the whole page taking over 60 seconds to execute.

"Fatal error: Maximum execution time of 60 seconds exceeded in /***/panel.php on line 35"

The code is as follows.

[PHP]
<html>
<head>Text</head>
<body>

<?

$loggedin=0;

$dbusername="*****";
$dbpassword="*****";
$database="*****";

if (isset($_COOKIE['sINFO'])) {

$contents=$_COOKIE['sINFO'];


mysql_connect(localhost,$dbusername,$dbpassword);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT name, password FROM users";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

$i=0;
$cancelwhile=0;
while ($i<$num && $cancelwhile==0) {
$check=mysql_result($result,$i,"name");
$check.=mysql_result($result,$i,"password");

$check=md5($check);

if ($contents==$check) {

echo ("Welcome back ".mysql_result($result,$i,"name"));
$cancelwhile=1;
$loggedin=1;

}

$i++;
if ($i=$num && $cancelwhile==1) {echo ("You are not logged in.");}

}



}else{
echo ("You are not logged in.");
}


if (loggedin==1) {

echo ("<br>Select an option.");

}


?>



</body>
</html>
[/PHP]

Line 35 is:
[PHP]if ($contents==$check) {[/PHP]

Am I executing a command incorrectly, is my connection too slow, or is my code just taking too long to execute?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 76
Reputation: leelee is an unknown quantity at this point 
Solved Threads: 1
leelee leelee is offline Offline
Junior Poster in Training

Re: Maximum execution time exceeded.

 
0
  #2
Oct 20th, 2005
[proviso]I've not properly looked through your code.[/proviso]

It could be the entire script, or it might not be getting a response that it was expecting when, for example, you're trying to access the cookie.

This might help you with debugging: http://uk.php.net/function.set_time_limit
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 294
Reputation: zippee is an unknown quantity at this point 
Solved Threads: 6
zippee's Avatar
zippee zippee is offline Offline
Posting Whiz in Training

Re: Maximum execution time exceeded.

 
0
  #3
Oct 20th, 2005
The error is referred to execute time up to line 35.

It is very likely there is error in your php code (may be an endless loops etc). I suggest you use echo to display values in $contents (after line 15) and in $check (after line 33), before solving line 35.

I'm not quite sure that you close the mysql connection before call the results??
Ecommerce-Web-Store.com Building Your e-Business.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 902
Reputation: chrisbliss18 is an unknown quantity at this point 
Solved Threads: 23
chrisbliss18's Avatar
chrisbliss18 chrisbliss18 is offline Offline
Posting Shark

Re: Maximum execution time exceeded.

 
0
  #4
Oct 20th, 2005
I don't understand your code at all. Why are you running a loop to check every record in the table for the value in the cookie? Why don't you just execute a query that checks for the existence of the value you are looking for and save yourself a lot of execution time and headaches?
Did we help you? Did we miss the point entirely? Update your thread and let us know.
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 23
Reputation: Khishin is an unknown quantity at this point 
Solved Threads: 0
Khishin Khishin is offline Offline
Newbie Poster

Re: Maximum execution time exceeded.

 
0
  #5
Oct 20th, 2005
Originally Posted by zippee
The error is referred to execute time up to line 35.

It is very likely there is error in your php code (may be an endless loops etc). I suggest you use echo to display values in $contents (after line 15) and in $check (after line 33), before solving line 35.

I'm not quite sure that you close the mysql connection before call the results??
There was an endless loop, the page that set the cookie did not convert the username to lowercase before encrypting.

And it looks like you should close the connection as soon as possible to make it easier on the server so it doesn't have to keep listening for requests. TI think the query places the contents of the rows into $result rather than linking the two.

Originally Posted by chrisbliss18
I don't understand your code at all. Why are you running a loop to check every record in the table for the value in the cookie? Why don't you just execute a query that checks for the existence of the value you are looking for and save yourself a lot of execution time and headaches?
Because that's all I knew to do.

Looking around, do you mean a query like this?
[PHP]$query="SELECT name, password, md5 FROM users WHERE md5=$check";[/PHP]
Where I call the cookie into $check earlier and create a new column 'md5' with pre-calculated hashes?

And if I removed the first reference to the md5 column in the above, would it still be able to use the WHERE portion of the query?
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 294
Reputation: zippee is an unknown quantity at this point 
Solved Threads: 6
zippee's Avatar
zippee zippee is offline Offline
Posting Whiz in Training

Re: Maximum execution time exceeded.

 
0
  #6
Oct 20th, 2005
Try this (I hope this is what you after [php]$contents=$_COOKIE['sINFO'];

mysql_connect(localhost,$dbusername,$dbpassword);
@mysql_select_db($database) or die( "Unable to select database");

$query = "SELECT name, password FROM users";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$check = md5($row['name'].$row['password'];
if($check==$contents) {
echo "Welcome back ".$row['name'];
$loggedin = 1;
}
}

if (loggedin==1) {
echo "<br>Select an option.";
}
else {
echo "You are not logged in.";
}[/php]
Ecommerce-Web-Store.com Building Your e-Business.
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 23
Reputation: Khishin is an unknown quantity at this point 
Solved Threads: 0
Khishin Khishin is offline Offline
Newbie Poster

Re: Maximum execution time exceeded.

 
0
  #7
Oct 20th, 2005
Well, I think what Chris was saying was to use the WHERE extension on my query so I don't have to use the while loop.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 11
Reputation: pc2forum is an unknown quantity at this point 
Solved Threads: 0
pc2forum pc2forum is offline Offline
Newbie Poster

Re: Maximum execution time exceeded.

 
0
  #8
Mar 2nd, 2006
u can remove the error by modifying the entry in php.ini file in ur webserver settings
set maximum_exec_time=300 // which increase the maximum script time for ur script
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC