PDA

View Full Version : php login account crashing server


davidj
09-23-2005, 02:40 PM
I have an application which i built ages ago (LAMP)

I have a user logging in under an account (99999999 - test) which is crashing the machine (not the server)

i remember a few years ago with an ASP app i had a system with a memory leak which would do the same thing over time but this is happening once you login under this account.

i have never experienced leaks through PHP

any ideas

davidj
09-23-2005, 04:27 PM
i have just copied the mysql db to the test machine and copied the site as well and its fine

it must be a machine issue

on the faulty machine i am running the site through https @ 128 bit encryp but dont have that environment on the test machine. Its becoming a headache.

especially on a friday!

its weird..... I should have been a fireman or a traffic warden or a bomb disposal expert....... way less stress

domedia
09-23-2005, 05:09 PM
Can't help you with the PHP..
can only relate to fridays.. of course I get notified to put 2 sites live today... there goes the weekend?

davidj
09-27-2005, 12:31 PM
Doh !!!!!!!

hehe it was my fault....



mysql_select_db($database_northgate, $northgate);
$query_groups = "SELECT * FROM group1";
$groups = mysql_query($query_groups, $northgate) or die(mysql_error());
$row_groups = mysql_fetch_assoc($groups);
$totalRows_groups = mysql_num_rows($groups);

//****************************************
$vargroups="";
$or="";
do {

$vargroups = $vargroups.$or." xref.xref_payroll like '_".$row_groups['group_ref']."_'";
$or=" or ";
} while ($row_groups = mysql_fetch_assoc($groups));
//**************************************

mysql_select_db($database_northgate, $northgate);
$query_xref = "SELECT * FROM xref where $vargroups group by xref_payroll";
$xref = mysql_query($query_xref, $northgate) or die(mysql_error());
$row_xref = mysql_fetch_assoc($xref);
$totalRows_xref = mysql_num_rows($xref);


xref table had 90000 records
group1 table had 5000 records

when i echo'd this query

mysql_select_db($database_northgate, $northgate);
$query_xref = "SELECT * FROM xref where $vargroups group by xref_payroll";
$xref = mysql_query($query_xref, $northgate) or die(mysql_error());
$row_xref = mysql_fetch_assoc($xref);
$totalRows_xref = mysql_num_rows($xref);

i got

SELECT * FROM xref where payroll_ref like '_345_' and payroll_ref like '_346_' and payroll_ref like '_355_'

<span style='color:red'>etc etc etc etc etc etc 5000 times</span>

;) ;) ;) ;)

this brings down servers !!!! BIG TIME