Hi

I have a webhost, and I want to let users have download from my site.
But in order to have enough permission to download file, users have to
pay a fee.
I put my files in a directory, and I put a password for this directory
(http://www.rayanik.com/secure). Everything works fine.
But now, I want to write a program with PHP, in order to do payment
process, and after successful payment, open this directory, and send
mime-headers, and then file contents. Here is the problem:
(http://www.rayanik.com/secure.php)
The code is here:

<?
    $dir = opendir("/secure");
    while ($file = readdir($dir))
    {
           echo "$file<br>";
    }
    echo "<hr><br>";
    closedir($dir);
?>

How can I have access to secure directory, while it has password
protection (basic authenticate with Apache)?
Regards,
Amir Hosein Rushenas

    Write a Reply...