Have a database with IP address as the primary key and two other values: download count and expire time. Whenever someone downloads a file through your script, you find the entry for the IP and increment the counter (and set/reset expire time as needed).
Or just have special directory and file names that you change regularly (with the download script or a cron job) - maybe not change the actual directory, but just through a .htaccess file.
You'd probably want to keep the directory of files outside of the webtree as well, so people cannot directly link to it (and so would need to access your php scripts to get the file)
Or just have special directory and file names that you change regularly (with the download script or a cron job) - maybe not change the actual directory, but just through a .htaccess file.