<?php

$filename = "PSP-M4M-i032-";
$ext = ".jpg";

$dir = ".";
$dh = opendir( $dir ) or die( "Cannot open image directory" );
$page = $_GET['page'];

while ( ! ( ( $file = readdir ( $dh ) ) === false ) ) {
	if ( is_dir( $dir."/".$file ) || !strstr( $file, ".jpg" ) ){
		print "";
	} else {
		$images[] = $file;
	}
}

sort( $images );

$time = mktime ( 1, 39, 0, 7, 11, 2009 );

for ( $i = 0; $i < count( $images ); $i++ ) {
	
	$no = $i + 100;

	if ( $no < 10 )
		$no = "00".$no;
	else if ( $no > 9 && $no < 100 )
		$no = "0".$no;
	
	$oldname = $images[$i];
	
	rename( $images[$i], $filename.( $no ).$ext );
	$images[$i] = $filename.( $no ).$ext;
	print $oldname.", ".$images[$i]." - ".date( "r", $time )."<br/>";
	touch( $images[$i], $time );
	$time+=60;
}

?>