The site I am managing is: http://edge.steyoyoke.com/ The site lets users download zip files, once they have paid for a subscription. They purchase the subscription from another site, and the user is manually created in edge.steyoyoke.com
The problem is, that I need the users to only be allowed access to the files created within one year of when they joined. So everything that was uploaded during the time the user is a paid member, they can download, but only during that time.
Right now each new user gets a data.txt file which looks something like like with the data filled in:
{"pass":"xxx","welcome":"Hello [NAME]!","fullname":"xxx","email":"xxx","cookie":"e$nbe8bk#c6uh&a4sfjs29x7$y7vd7"}
When the user logs in, files from the user 'universal' are retrieved.
<?php $universal = new User( 'universal' );
if( $universal->exists() ) {
$universal->get_files();
if ( count( $universal->files ) ) {
echo '<ul class="section">';
foreach( $universal->files as $file )
echo '<li><a href="file.php?universal=true&name='.urlencode($file).'">'.$file.'</a> <small>'.size($universal->path.$file).'</small></li>';
echo '</ul>';
}
} ?>
Thus far I've used this code to get the date that the user's data.txt file was created.
$iterator = new FilesystemIterator( 'users/nicholaskearney' );
foreach($iterator as $fileInfo){
if($fileInfo->isFile()){
$cTime = new DateTime();
$cTime->setTimestamp($fileInfo->getCTime());
}
if($fileInfo->isDir()){
$cTime = new DateTime();
$cTime->setTimestamp($fileInfo->getMTime());
}
}
So I can get when date when the user's data file was created, and I can get the current date, but I am stumped as to where to go from here.
I should say that I am new to PHP programming, and that this site was built by someone else, and I am now operating it.
Thanks in advance for any help!