Hi and thanks for your reply..
Though i had to try something different since scandir is from php 5 which i don't have (somewhere in 4..)
So i came up with this:
<?php
$directory = 'swf';
$directory_stream = @ opendir ($directory)
or die ("Could not open <i>$directory</i>");
while ($entry = readdir ($directory_stream)) {
$randomday=mt_rand(1,30);
$randommonth=mt_rand(9,12);
$year="2006";
if ($randommonth == 9)
{
$randommonth="September";
}
if ($randommonth == 10)
{
$randommonth="Oktober";
}
if ($randommonth == 11)
{
$randommonth="November";
}
if ($randommonth == 12)
{
$randommonth="December";
}
$file=$directory."/".$entry;
$new_date = strtotime($randomday." ".$randommonth." ".$year); // set the required date timestamp here
echo $new_date."<br>";
touch($file,$new_date);
echo "<br />\n$entry<br>";
}
?>
And though it works, it works partially, i get random dates for a whole folder, but some files in that particular folder have really weird dates like the year 1607 or something like that.
I echoed the output and this is what php gave me:
1165532400 // echo the date
Warning: utime failed: Operation not permitted in /var/www/testsite/dirarray.php on line 51 // Permisson problem?
. // Ok this is a directory level
-1
Warning: utime failed: Operation not permitted in /var/www/testsite/dirarray.php on line 51 // Permisson problem?
.. // Directory level as well so..
-1
00020.jpg // filename
1162335600 // new date, is ok
00001.jpg // filename
1162681200 // new date, is ok
00002.jpg
1159567200
00003.jpg
1159480800
00004.jpg
1166914800
00005.jpg
1158703200
00006.jpg
-1 // So why does this not work?
00007.jpg
1166914800
00008.jpg
1164063600
So i'm wondering; i apparantly do not have permissions to change certain files? i chown'ed the folder to 'nobody', which is, as far as i know, used by php.
But i didn't chown all the files in there, could that be something?
And the other most important think, is that some files get -1, which is the error returned by php if something goes wrong, but i'm nog getting the the error stated at the beginning about the permissions (if it's permissions anyway..)
So the big question is: What is going wrong? I'm confused..
Any help greatly appreciated!