Click to See Complete Forum and Search --> : Coupon Codes, how to make them fast.


Kyleva2204
01-31-2005, 06:48 PM
hey yall!! The Forum topic "Discount Code" made me think about coupon codes, and how they make them in large numbers, while still having validation on ALL of them.. I was like this has to be REALLY time consuming, so I made a script that would make a list of numbers and be prevalidated on them by a mathematical equation.. $num1 + ($num4 - $num2) * $num3 - $num5 == $number .. What you do, is you give a number to the script, like 10.. and it fits a number into every one of those variable.. 1 - 9, and sees if the equation works, if it does.. it will take the numbers that it used to make it work and put them together as one whole number.. like 02050.. and to tell what kind of coupon the code represents, you could add a number like 4 to the end, and the PHP will pickup on it once it validates the code and tells its a 10% discount, but to make sure that your not lying, if you have a number like 2, the PHP will say you are typing to find the number that matches to 20... and if it does, the coupon is 100% valid.. YAY!!! hahah does anyone one this script for learning purposes, or for their own weird use?? haha.. if so ill post it.. :)

NogDog
01-31-2005, 07:40 PM
Or, you put your coupon data into a properly designed and indexed database table, and you can have thousands of coupons with minimal performance impact. :)

Kyleva2204
01-31-2005, 07:46 PM
Originally posted by NogDog
Or, you put your coupon data into a properly designed and indexed database table, and you can have thousands of coupons with minimal performance impact. :) ok yeah, but haha ok shut up :D... I was bored and wanted an alternative way to go about it.. hahaha.. Neways, if anyone wanted to use my code for learning.. then its there.. haha