I added the part in red below. Why would that create a stray process causing the server load to shoot up and, sometimes crash?
function viewStatus($self,$password) {
if (authUser($password)) {
$queryGetData = "SELECT * FROM pagecounter order by visits DESC LIMIT 10";
$resultGetData = mysql_db_query(DATABASE, $queryGetData) or die ("Query failed: error was ".mysql_error());
$o .=" <table width=100%>\n";
$o .=" <tr>\n";
$o .=" <td width=\"100%\">\n";
$o .=" <font face=verdana size=3 color=#990000><b>Most read articles</b><font>\n";
$o .=" </td>\n";
$o .=" </tr>\n";
for($i=0;$row=mysql_fetch_array($resultGetData);$i++) {
// addon
$fd= fread(fopen("$row[page]", "r"), 100000);
if ($fd)
{
$start= strpos($fd, "<title>");
$finish= strpos($fd, "</title>");
$length= $finish-$start;
$code_grabbed=Substr($fd, $start, $length);
$title=str_replace("<title>", "", $code_grabbed);
}
// addon
$i % 2 ? 0: $bgcolor = "#ebebeb";
$o .=" <tr bgcolor=\"$bgcolor\">\n";
$o .=" <td>\n";
$o .=" <li><font face=verdana size=1><a href=$row[page]><b>$title</b></a></font></li>\n";
$o .=" </td>\n";
$o .=" </tr>\n";
}
$o .=" </table>\n";