Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Apr 2009
    Posts
    264
    Thanks
    24
    Thanked 1 Time in 1 Post

    PLEASE HELP! PHP Discount code!

    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~

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    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

  • #3
    Regular Coder
    Join Date
    Apr 2009
    Posts
    264
    Thanks
    24
    Thanked 1 Time in 1 Post
    Ok fine, u can use a database. but a text file database ONLY

  • #4
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    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.

  • #5
    Regular Coder
    Join Date
    Apr 2009
    Posts
    264
    Thanks
    24
    Thanked 1 Time in 1 Post
    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.

  • #6
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    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.
    Rowsdower! has accused me of having mental problems, and the administrator allowed it. What a great forum huh?

  • #7
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    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;
    PHP Code:
    // 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.

  • #8
    Regular Coder
    Join Date
    Nov 2009
    Location
    Hamilton, New Zealand
    Posts
    126
    Thanks
    0
    Thanked 17 Times in 17 Posts
    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.
    Affordable Web Design (New Zealand Based)
    Internet Marketing Guru
    PHP/mySQL Expert
    -------------------------------------------

  • #9
    New Coder
    Join Date
    Dec 2009
    Posts
    84
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by masterofollies View Post
    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.
    i think so, check it here http://www.codingforums.com/showthread.php?t=186469
    Best Regards,


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •