crEA-tEch
04-03-2009, 03:38 AM
Hi there guys,
I'm having somewhat of an issue with some PHP that I (personally) can see no fault with, definatly not to the stage of crashing a server!!
It crashes 25% of the time when this piece of code is executed:
<?
include('db.php');
$id=$_POST['id'];
$order=$_POST['order'];
$original=$_POST['original'];
$var=$_POST['var'];
$equipment_model_id=$_POST['equipment_model_id'];
$serialnumber=$_POST['serialnumber'];
$location_id=$_POST['location_id'];
$computer_name=$_POST['computer_name'];
$network_connect=$_POST['network_connect'];
$licencekey=$_POST['licencekey'];
$comments=$_POST['comments'];
$serialnumber = strtoupper($serialnumber);
$computer_name = strtoupper($computer_name);
$licencekey = strtoupper($licencekey);
$network_connect = strtoupper($licencekey);
$network_connect = ucwords($network_connect);
$comments = addslashes($comments);
$query = "SELECT * FROM locations WHERE location_id = '$location_id' LIMIT 1";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$location = ($row['location']);
$block = ($row['block']);
}
$query = ("UPDATE equipment SET equipment_model_id = '$equipment_model_id', serialnumber = '$serialnumber', location = '$location',
block = '$block', computer_name = '$computer_name', network_connect = '$network_connect', comments = '$comments', licencekey = '$licencekey'
WHERE equipment_id = '$id' LIMIT 1");
mysql_query($query)or die(mysql_error());
mysql_close();
$msg = "<font color=red> - The Equipment Has Been Updated</font>";
include $original;
?>
When the code does work it works perfectly and as fast as it should, but when it doesn't thats when the server crashes.
This code has been working fine for the best part of a year, but recently when I decided to carry over a variable which is the original PHP page name (formated something like view_locations.php) it would timeout and my boss had to restart IIS.
The only thing that has changed is, $original=$_POST['original']; at the start of the code, and obviously include $original; at the bottom.
(incidently, I have also tried include($original), include('$original'), and also request($original), request('$original'), and request $original); too with no luck.
Does any have any idea whatsoever what's going on??
Nick
I'm having somewhat of an issue with some PHP that I (personally) can see no fault with, definatly not to the stage of crashing a server!!
It crashes 25% of the time when this piece of code is executed:
<?
include('db.php');
$id=$_POST['id'];
$order=$_POST['order'];
$original=$_POST['original'];
$var=$_POST['var'];
$equipment_model_id=$_POST['equipment_model_id'];
$serialnumber=$_POST['serialnumber'];
$location_id=$_POST['location_id'];
$computer_name=$_POST['computer_name'];
$network_connect=$_POST['network_connect'];
$licencekey=$_POST['licencekey'];
$comments=$_POST['comments'];
$serialnumber = strtoupper($serialnumber);
$computer_name = strtoupper($computer_name);
$licencekey = strtoupper($licencekey);
$network_connect = strtoupper($licencekey);
$network_connect = ucwords($network_connect);
$comments = addslashes($comments);
$query = "SELECT * FROM locations WHERE location_id = '$location_id' LIMIT 1";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$location = ($row['location']);
$block = ($row['block']);
}
$query = ("UPDATE equipment SET equipment_model_id = '$equipment_model_id', serialnumber = '$serialnumber', location = '$location',
block = '$block', computer_name = '$computer_name', network_connect = '$network_connect', comments = '$comments', licencekey = '$licencekey'
WHERE equipment_id = '$id' LIMIT 1");
mysql_query($query)or die(mysql_error());
mysql_close();
$msg = "<font color=red> - The Equipment Has Been Updated</font>";
include $original;
?>
When the code does work it works perfectly and as fast as it should, but when it doesn't thats when the server crashes.
This code has been working fine for the best part of a year, but recently when I decided to carry over a variable which is the original PHP page name (formated something like view_locations.php) it would timeout and my boss had to restart IIS.
The only thing that has changed is, $original=$_POST['original']; at the start of the code, and obviously include $original; at the bottom.
(incidently, I have also tried include($original), include('$original'), and also request($original), request('$original'), and request $original); too with no luck.
Does any have any idea whatsoever what's going on??
Nick
