Promo Code PHP Script

Discussion in 'General Marketing' started by monster24, Oct 8, 2007.

  1. #1
    Hi there,

    I am have just build my site and the concept is that I have a squeeze page with an attractive free offer. If the visitors opt-in they will be transferred to an one-time-offer product. But I want that this page shows some randomly generated promo codes. If the visitors uses this code they can save 50% or something of the price. I know people love this promo codes and I need a php script or similar that can exactly do that. I looked around but I couldn't find any ...

    can anyone recommend me promo code script ?
    Thanks
    Thomas
     
    monster24, Oct 8, 2007 IP
  2. l3vi

    l3vi Peon

    Messages:
    375
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Here is a function to show a random generated 6 alphanumeric code.. beyond that you need someone to code something like below to work with your billing/service.

    <?
    	/* // Example:
    	$promo_code = promoCode();
    	print $promo_code;
    	*/
    	
    	function promoCode() {
    		// Coded by Levi at boogybonbon.com
    		// Enjoy!
    		return substr(md5(time()), 0, 6);
    	}
    ?>
    PHP:
     
    l3vi, Oct 9, 2007 IP
  3. woocha

    woocha Peon

    Messages:
    107
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3


    I was looking for the same thing as monster24, so thanks a bunch l3vi...this will com ein very handy
     
    woocha, Oct 21, 2007 IP
  4. John84

    John84 Active Member

    Messages:
    1,288
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    80
    #4
    Useful snippet, thanks for sharing. Any way to ensure that the same string of numbers won't be generated twice?
     
    John84, Oct 22, 2007 IP
  5. l3vi

    l3vi Peon

    Messages:
    375
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It should not use the same string as its based on a time() value that is always moving forward. However if your storing the codes its not that hard to write a class to manage it all and if the code has already been used reject the code, etc.
     
    l3vi, Oct 22, 2007 IP
  6. woocha

    woocha Peon

    Messages:
    107
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6


    do you have a quick examples on how that might be done?
     
    woocha, Oct 22, 2007 IP
  7. l3vi

    l3vi Peon

    Messages:
    375
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Quick example without a working db manager yes:

    <?
    
    while(usedPromos(promoCode())==false);
    // ^^ -- Its is an endless look that will not move forward untill the code is found without a match.
    
    function UsedPromos($code) {
    	
    	// Connect to DB and check Code
    	// If no code return TRUE, otherwise return false.
    }
    
    // Another Example:
    
    if(usedPromos(promoCode())==false) { echo "Bad Code"; } else echo "good code";
    ?>
    PHP:
     
    l3vi, Oct 22, 2007 IP
  8. woocha

    woocha Peon

    Messages:
    107
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Hey Thnks a lot L3VI...I appreciate it :)
     
    woocha, Nov 9, 2007 IP