Search
Left Quote    I find that the harder I work, the more luck I seem to have.
- Thomas Jefferson    
Right Quote
 
[login] | [Register]
 

Accept Coupon Codes for Downloads

by: sm0ke
Page: 1 of 3
(View All)

Introduction


This 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.

1  |  2  |  3  |  
Next »


No Comments for this page.

You Must be logged in or a member to comment.


Tutorial Stats

Tutorial Stats

6,060 Views
0 Total Comments
3 Rating of 5 (1 Votes)

Options

Tutorial Options

· Login to Rate This Article
· Login to Post a Comment
· Read more by this author
Digg This Article! Del.icio.us: Bookmark This Article Reddit: Bookmark This Article BlinkList: Blink This Article! YahooMyWeb BlogMarks: Add This Mark! Furl: Save This Article Spurl: Mark This Article

Articles

Related    

· Simple PHP Tutorial
· One File Website
· Pagination with PHP
· Building a Comments Script
· Complete Members System
· Variable Scope


Cheap Flights - Guitar Lessons - Arizona Pools - Loans

"AllSyntax.com" Copyright © 2002-2007; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank