My ISP (Heart Internet) has told me on Monday that one of my pages is running a permanent server process. I have no idea what one of these is or how I have manage to start one running and their support dept is being very unhelpful. It appears my code may be running an infinite loop.

How is this possible in PHP I thought everything ceases as soon as the page is closed?

I don't close my Mysql connections as I understood this wasn't necessary, and I dont use mysql_pconnect. Is it?

I've checked and checked my code but can see nowhere where an infinite loop might occur.

<?php
	if (isset ($_POST['submit'])) {
		$message = 'The Following Problems Occurred : -';
		require('Scripts/bigEnough.inc');
		require('Scripts/match2RegExp.inc');
		$message = bigEnough($_POST['name'], 2, 'Name', $message);
		$message = bigEnough($_POST['telephone'], 2, 'telephone', $message);
	
		$message = match2RegExp($_POST['email'], 'email', $message);

		if(strlen($message) <= 35) {//there where no validation errors
		
			$actualMonth = $_POST['month']+1;
			//confirm booking with customer
			$body= "Thank you for booking your service work on {$_POST['make']} {$_POST['model']}  {$_POST['registration']} on {$_POST['day']} \\ $actualMonth \\{$_POST['year']}  with North Jesmond Garage.\n Your booking has been received.\n We'll see you on the day!\n Regards \t\t Service Department.\n\nHours\n Mon - Fri 8:00am - 5:30pm\nSat 9:00am - 1:00pm";
  mail ($_POST['email'],'Service Booking Confirmation',$body, 'From: [email]andrew@north-jesmond-garage.co.uk[/email]');
//echo $body;

			// send email to garage
			$body2= "Customer title  = \t{$_POST['title']}\n Name = \t{$_POST['name']}\n Address = \t{$_POST['address']} \nTelephone = \t{$_POST['telephone']} \nEmail = \t{$_POST['email']} \nVehicle Make = \t{$_POST['make']} \nVehicle Model = \t{$_POST['model']}\n Registration = \t{$_POST['registration']}\n Work Required = \t{$_POST['workRequired']} \n Date = {$_POST['day']} \\ $actualMonth \\{$_POST['year']}";
			mail ('andrew@north-jesmond-garage.co.uk','Service Booking',$body2);

			// update database
			include ('../cgi-bin/mySqlConnect.php');//connect to PHP database
			$theTitle = mysql_real_escape_string($_POST['title']);
			$theName = mysql_real_escape_string($_POST['name']);
			$theAddress = mysql_real_escape_string($_POST['address']);
			$theTelephone = mysql_real_escape_string($_POST['telephone']);
			$theEmail = mysql_real_escape_string($_POST['email']);
			$theMake = mysql_real_escape_string($_POST['make']);
			$theModel = mysql_real_escape_string($_POST['model']);
			$theRegistration = mysql_real_escape_string($_POST['registration']);
			$theWorkRequired = mysql_real_escape_string($_POST['workRequired']);
			$theDay = mysql_real_escape_string($_POST['day']);
			$theMonth = mysql_real_escape_string($actualMonth);
			$theYear = mysql_real_escape_string($_POST['year']);
			
			$query= "INSERT INTO bookings (title, name, address, telephone, email, make, model, reg, workReq, day, month, year) VALUES ('$theTitle', '$theName', '$theAddress', '$theTelephone', '$theEmail', '$theMake', '$theModel', '$theRegistration', '$theWorkRequired', '$theDay', '$theMonth', '$theYear')";
			$result = mysql_query ($query) or die (mysql_error()."<br />Couldn't execute query: $query");
		
			mysql_close();
			
			header("location: thanks.html");
		}		
	}
	
?>

Any help would be greatly appreciated as My ISP can use strong arm tactics and throw you off their servers without giving the chance, or any help to fix the problem.

regards

Culp

hmm.. I dont see any infinite loop ! You can debug this script by putting your custom message after few lines followed by an exit. Repeat this step until you find an infinite loop! Also check the files you are including for an infinite loop.

Cheers,
Naveen

thanks for the pointers I'll give this a whirl!

This article has been dead for over six months. Start a new discussion instead.