Jump to content

Archived

This topic is now archived and is closed to further replies.

DrumDude

Fatal error: Call to a member function read() on a non-object in

Recommended Posts

Hi,
I am totally new to PHP scripting but had to upgrade Apache and PHP because of security issues.
I upgraded from Apache 1.3.x and PHP 4.2.3 to Apache 2.0.54 and PHP 5.0.5.
I now get this error on my index.php page:
Fatal error: Call to a member function read() on a non-object on line 89.
Here is the code I will insert#89 so you know which line 89 is.
>
<?php

$fileHandle = fopen("dlconfig2.txt", "r");
while (!feof($fileHandle)) {

$aLine = fgets($fileHandle, 4096);
parse_str($aLine);


}
fclose($fileHandle);

for ($i = 0; $i < count($dropType); $i++) {
$typeToPrefix[$dropType[$i]] = $dropPrefix[$i];
}

$aDirectory = dir("");

#89 while ($anEntry = $aDirectory->read()) {

// Short cut because we know aDirectory only contains other directories.
if ($anEntry != "." && $anEntry!="..") {
$aDropDirectory = dir("");
$fileCount = 0;
while ($aDropEntry = $aDropDirectory->read()) {
if ((stristr($aDropEntry, ".html")))  {
// Count the files in the directory
$fileCount = $fileCount + 1;
}
}
$aDropDirectory.closedir();

$parts = explode("-", $anEntry);
if (count($parts) == 3) {

$buckets[$parts[0]][] = $anEntry;

$timePart = $parts[2];
$year = substr($timePart, 0, 4);
$month = substr($timePart, 4, 2);
$day = substr($timePart, 6, 2);
$hour = substr($timePart,8,2);
$minute = substr($timePart,10,2);
$timeStamp = mktime($hour, $minute, 0, $month, $day, $year);

$timeStamps[$anEntry] = date("D, j M Y H:i (O)", $timeStamp);

if ($timeStamp > $latestTimeStamp[$parts[0]]) {
$latestTimeStamp[$parts[0]] = $timeStamp;
$latestFile[$parts[0]] = $anEntry;
}
}
}
}

?>

Thanks for any help...

Share this post


Link to post
Share on other sites
You dont open any directory here....

[code=php:0]
$aDirectory = dir("");
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.