Hi =)
On my home box I have PHP4 on windows/apache running, but on the website for which this is written is PHP3. This works perfectly on my local, but not on the linux php3 box. Please would anyone be able to enlighten me? I've urged the owner to upgrade to PHP4, but alas, no joy... yet.
FYI, the script deals with files output by a C program, a 'MUD', at http://wotmud.org/ (ie see tales from the light). These are the boards from the game. because of the way that they are output they are saved and overwritten every 10 minutes or so, so in order to make a 'today's posts' type page I have to go into each, extract the timeand day and compare them to today.
Basically, this is a php4 script that runs through all the files in a directory whose names match a "Boards-> .php" pattern. It then looks in each file and extracts some data (name, title, date), compares dates to today and if they're the same, prints it to the browser. But it won't play on 3, but it's perfect on my local on 4=/.
Any help would be gratefully appreciated.
code:
<?
$foo = (date("D M j"));
print "Today's Messages ($foo)<br>";
$dh = dir ($directory_name);
while ($entry = $dh->read())
{
if (preg_match('/Boa.*.php/', $entry))
{
$file = fopen("$entry","r");
$text = fread($file ,200);
fclose($file);
$pos = strpos($text," ("); // GET POINTERS
$pos2 = strpos($text,") ");
$pos3 = strpos($text,"::");
$pos4 = strpos($text,"<BR>");
$pos5 = ( strpos($text,": ") + 2 );
$pos3b = ( $pos3 + 2 ) ; // ADJUST POINTERS FOR PUNCTUATION
$titlelength = ( $pos4 - $pos3 - 2 );
$title = substr($text,$pos3b,$titlelength);
$fullnamelength = ( $pos2 - $pos + 2);
$fullname = substr($text,$pos,$fullnamelength);
$datelength = ( $pos - $pos5 );
$date = substr($text,$pos5,$datelength);
if ( "$foo" == "$date" )
{
print("<a href=$entry>$title</a>$fullname");
}
}
}
$dh->close();
?>
The only change is that
$dh = dir ("/home/wot/nass/html.wotmud/boards");
is
$dh = dir ($directory_name);
on my PC at home.