PDA

View Full Version : Count views/downloads


Tidane
8-8-03, 12:50 PM
Does anyone know where I can find a PHP script so that a user can't download over a certian amount of files a month? Thanks.

Also, could I make a script that writes to the .htpasswd file, and puts in the username and password, after encription?

B&T
8-8-03, 01:00 PM
Originally posted by Tidane
. . . could I make a script that writes to the .htpasswd file, and puts in the username and password, after encription?

Try this to get you going:

$encrypted = crypt($pass);
$ht_pass = "username:$encrypted\n";
$filename = "/www/u/user/.htpasswd";
$handle = fopen($filename,"w");
fwrite($handle,"$ht_pass");
fclose($handle);

Obviously you must change the path to your htpasswd, your username, and put the password in $pass.

Tidane
8-8-03, 01:22 PM
Thanks, that'll help...now to figure out where I could put it...or how it make it work. lol

B&T
8-8-03, 01:30 PM
I use a variation of that to generate a random value, change the htpassword and email me the new password. I kick it off with cron every night so I have a new random password evey day.