Helping ordinary people create extraordinary websites!
GET OUR NEWSLETTER
Your Email:
 

Clickbank Security Using PHP

By Robert Plank
2005-05-25


Use mine

Here's a zip file containing your cb.php script: http://www.jumpx.com/tutorials/clickbank/cb.zip

Save it, unzip it, and open cb.php.  Near the top should be a line such as:

$secret_key = "YOUR_SECRET_KEY";

Change YOUR_SECRET_KEY to that secret key you set in the Clickbank control panel.

Now, for usage... your thank you pages will have to end in .php here.  Like, thankyou.php (and now it doesn't matter if they have obvious names or not -- because they'll be thoroughly inaccessible to thieves.  Remember, you can simply rename your HTML pages so they end in .php and they'll still work just fine.

Put this line at the top of you thank you page script:

<?php include("cb.php"); ?>

Be sure to upload cb.php to the same folder as your thank you page.  Now, when someone goes to the thank you page, the first thing the thank you script will do is run everything in cb.php, and cb.php will take the data Clickbank has passed to see if it matches.

You're going to have to change your Clickbank order links a little.  This is what they should look like now:

http://www.clickbank.net/sell.cgi?link=YOUR_CLICKBANK_ID/YOUR_PRODUCT_ID/YOUR_PRODUCT_NAME&seed=YOUR_SEED

Replace YOUR_CLICKBANK_ID with, of course, your Clickbank ID and YOUR_SEED with the seed you want to use.  This can be anything, something simple that's short and one word like the product name.  But NOT your secret key.

YOUR_PRODUCT_ID is the number Clickbank shows to the left of each thank you page as you add it.  When you're testing, be sure to set the price at $0.00.  Once everything's in place you can raise the price of the item to $19.95 or $29.95 or whatever it's priced at.

http://www.clickbankguide.com/merchant.htm#account will explain everything if you're a Clickbank newbie.

Tutorial Pages:
» The first step
» "Cookie Cutter" tools
» Using someone else's code
» Use mine
» Couldn't the download url, hash, and receipt be shared?


 | Bookmark
Related Tutorials:
» Port Scanning and Service Status Checking in PHP
» Web Database Access from Desktop Applications
» CubeCart 3.0 Installation and Configuration
» PHP Site Search Made Easy
» Installing and Configuring Drupal 6.1
» Desktop Application Development with PHP-GTK

Advertise with Us!


Tutorials Scripts Web Hosting Developer Manuals
Resources