Mattia,You could do this very easily with just an "autoresponder" file and a simple HTACCESS setup on your server.
There really is no need for placing any CGI script on your site unless you share that "thank you" page with other people. I suggest leaving this page strictly for the thank you from purchases made through ClickBank.
Here's how to do this in 3 easy steps:
Step 1: "Password protect" a directory on your server and place the files for download, inside this directory.
Step 2: Create a NEW index.html page and place the download names on it -- with URL's that point to the files they need have access to download. Place this index.html file into the password protected directory as well.
Step 3: Setup an autoresponder file that holds the login name and password into this protected directory. Place the URL for this directory into the autoresponder as well...
Here's an example letter you could use:
Dear Valued Customer:
Thank you for your most recent purchase of my {add the name of your product here}. To gain access to our download area where you can grab your copy of {product name}, click to the following URL:
http://www.yourdomain.com/password_protected_dir/index.html
This area is password protected. You will need the following username and password to access the files that await you:
Username = {username]
Password = {password}
Thank you again for your purchase! I look forward to serving you again in the future.
Kindest Regards,
Mattia
http://www.yourdomain.com
e-mail: mattia@yourdomain.com
Step 4: Place a LINK on your "thank you" page which will spawn the autoresponder to send them the e-mail that holds this important information. Also, let them know from the thank you page -- they must enter a "valid" email address or they will have a problem receiving the confirmation email to download their purchase.
Most hosting services online, provide a mailing list/autoresponder feature. Does yours? If so, you could make this "thank you" page access this autoresponder by asking for a valid email address in the box.... this in essence will also save their email address into a file, which will allow YOU to keep tabs on who has downloaded the material.
Just another option to consider. ;-)
Rozey
http://www.marketing-seek.com