1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[GET] PHP instant-win script

Discussion in 'PHP & Perl' started by openaidbh, Mar 20, 2012.

  1. openaidbh

    openaidbh BANNED BANNED

    Joined:
    Mar 3, 2012
    Messages:
    328
    Likes Received:
    320
    For those of you looking to incentivize CPA offers with instant-wins, or have any other use for an instant win script, here you go. It's quick and dirty, I wrote it with a limited knowledge of PHP but it works.

    PHP:
    <?php
    $s 
    rand(1,334000);
    $date date("l, F jS Y - H:i:s");

    if (
    $s !== 77)
    header("Refresh: 5; [yourdomainhere]/notawinner"); 

    if (
    $s == 7) {
    $to "[youremailaddresshere]";
     
    $subject "WINNER: #" .$s" at " .$date"!";
     
    $body "Winner winner chicken dinner #" .$s"!";
    if (
    mail($to$subject$body)) {
       echo(
    "<p>!</p>");
      } else {
       echo(
    "<p>...</p>");
      }

       
    header'Location: [yourdomainhere]/winner' ) ;
    }
    ?>
    How it works:
    The system randomly generates a number between 1 and 334,000 . If that number is 777, they win and are redirected to the win page and you're sent an email with the time/date of the win (I didn't feel like messing with an SQL database or any such nonsense). If not, they're sent to the lose page. Of course, you can tool with the numbers to suit your needs. Quick, easy, effective.

    You're welcome!
     
    • Thanks Thanks x 1
  2. paperdonut

    paperdonut Junior Member

    Joined:
    Dec 13, 2008
    Messages:
    128
    Likes Received:
    19
    Occupation:
    Marketer
    Location:
    SF
    Home Page:
    Nice share. I'll try it out.
     
  3. openaidbh

    openaidbh BANNED BANNED

    Joined:
    Mar 3, 2012
    Messages:
    328
    Likes Received:
    320
    Just realized there's an error with the code I posted. Change the "7" to "77" for the second if-then statement. I was going over my old posts and noticed that I messed up there. Be sure to fix this before implementing.