If statement not evaulating, any ideas where my error is?
Posted: Fri Oct 06, 2006 5:55 pm
Problem is, as of now it only says articles are older than 10 days, when i know for sure i addedone, so its not. It should say there isa new one. However, it doesn't.
Code: Select all
<?php
#new graphic, besides link to article
$img = "<img src=http://www.akimm.com/images/new1.gif>";
#path for files
$path = "article/";
#check to see its a directory
if(is_dir($path)) {
#if so establish handle
$handle = opendir($path);
#while loop to read through that established handle
while ($file = readdir($handle)) {
#validate that it is a file
if (is_file($path.$file)) {
#from the time it is now, minus the time when it was made
$diff = round((time() - filectime($path.$file))/3600/24);
#if its less than 10 days then echo link statinga new link
if ($diff < 10) {
echo "<ul>" . "<li>" . $img . $file . "<a href=http://www.akimm.com/philosophy.php>" . " Click to view " . "</a>" . "</li>" . "</ul>";
#break loop, my task is done
break;
} else {
#else, its older than 10 days, at whichpoint i invite someone to add an article
echo "<br />" . "<br />" . "no new articles, add one by" . "<a href=http://www.akimm.com/add_art.php>" . "clicking here " .
"</a>";
#break that loop task is done
break;
#close the directory, we are done reading it
closedir($handle);
}
}
}
}
?>