...

View Full Version : PLEASE HELP! PHP Discount code!



ShadowIce
01-11-2010, 02:19 PM
Does anyone know where I can get a PHP Discount code that generates alot of codes, and where a certain string such as 000-000-00000 can only be used ONCE, and NOT use a database?

I GREATLY appreciate it! :)

Thanks!

Shadow~

angst
01-11-2010, 02:41 PM
well, you would need some sort of data base, even if it's just a flat txt file that holds the coupon code, but it would be slower to search and manage.

have a look at the rand() function: http://php.net/manual/en/function.rand.php

ShadowIce
01-11-2010, 03:39 PM
Ok fine, u can use a database. but a text file database ONLY

angst
01-11-2010, 03:47 PM
if your looking for someone to do the work for you, then you've come to the wrong place, however if you would like *help* building it, the I can help.

ShadowIce
01-11-2010, 03:51 PM
God. I wish u people would quit thinking I want it done for me. No I don't want it done for me, I want a simple example which I can build my skills on. That's all, now if u don't want to help, that's fine, but don't come to MY thread, and tell ME that I'M asking someone to do it for me. That's just NOT right.

masterofollies
01-11-2010, 03:56 PM
Getting an attitude with us isn't going to help you. I would have written the whole code out for you, as I planned to do until I read your last reply.

Show us the respect we deserve or else move on.

angst
01-11-2010, 04:02 PM
well judging by your replies thats exactly what your asking, so maybe you should be more clear of what your asking if thats not the case. since it seems clear that you haven't even attempted to coming up with something. after I had made a suggestion your response was "Ok fine, u can use a database. but a text file database ONLY".


ok, so here's an example;


// build coupon codes
$CouponValues = "";
while($counter <= 50){
$counter++;
$CouponValues .= rand(1000000,2000000) . "\n";
}

// write codes to file
$filename = 'coupons.dat';
$handle = fopen($filename, 'a');
fwrite($handle, $CouponValues);
fclose($handle);



good luck with the rest. don't worry I wont post in YOUR THREAD again.

Rebbu
01-11-2010, 07:03 PM
I just want to mention, don't forget to implement some security for the txt based DB, else anyone with a bit of basic knowledge could easily access it. This may seem like a very simple point, but it's sometimes the simple things we are more likely to forget.

sir.jones
01-11-2010, 07:30 PM
Getting an attitude with us isn't going to help you. I would have written the whole code out for you, as I planned to do until I read your last reply.
Show us the respect we deserve or else move on. :D i think so, check it here http://www.codingforums.com/showthread.php?t=186469



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum