![]() |
|
||||||
IntroductionThis tutorial may be useful if you want to deliver downloads using coupon codes to verify authorization to access the file. This method is in no way secure and should not be run on a production environment but is mereley to introduce a quick and easy method to verify coupon codes and direct customers to the correct file requested. Create the Tables Firstly we need to create the tables one to hold our download information and one to house the coupon codes. In the "file" field were not including the extension so if the download file was called file.zip, the only information entered would be file without the ".zip" extension . Logging into the database Here we need to create a new directory under the public directory (root) called "site" open up a text editor (I reccomend metapad) and enter the following information Save the file as site.inc.php in the newly created site directory. The above file is quite straighforward, it holds all your database access information and creates 2 functions: db_login() and db_logout() these functions can be called in any script which includes the site.inc.php file to log in and out of the database. OK, we have the tables created on our database, and a way to log in and out of the database saved in a site.inc.php file in the site directory. You now need to add your products to the downloads table and your coupon codes to the coupon table - I'll let you add these, you may already have a products table in place so you can just ignore the create table and use your existing products database by changing a few variables within the script.
No Comments for this page. |
|
|||||||||||||||||||||||||||||||||||||