Email address contest script

Discussion in 'PHP' started by Drew007, Mar 11, 2007.

  1. #1
    Hello programmers. I will be promoting my site at a trade show and this is what I would like:

    1. Simple script where people can type in their email address and it is saved to a databse.
    2. I can then ask the script to pull a radnom email address from the database for a prize winner.

    Is there anything like this out there? Thanks in advance.
     
    Drew007, Mar 11, 2007 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,842
    Likes Received:
    4,543
    Best Answers:
    123
    Trophy Points:
    665
    #2
    Using forms in Excel you could do that pretty easily, with no need for website programming etc.

    If you were able to connect to the net it's a very easy script again.
     
    sarahk, Mar 11, 2007 IP
  3. Drew007

    Drew007 Peon

    Messages:
    310
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    How would you get excel to pick one at random?
     
    Drew007, Mar 11, 2007 IP
  4. Louis11

    Louis11 Active Member

    Messages:
    783
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    70
    #4
    I could code this in a day if you're interested, but I would search google first. I'm sure there is something like this out there.
     
    Louis11, Mar 11, 2007 IP
  5. Drew007

    Drew007 Peon

    Messages:
    310
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Drew007, Mar 11, 2007 IP
  6. Drew007

    Drew007 Peon

    Messages:
    310
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Drew007, Mar 11, 2007 IP
  7. Estevan

    Estevan Peon

    Messages:
    120
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    0
    #7
    hello here is a lite script maybe help you
    /////////////// CREATE A FILE email.txt (chmod 666)
    /////////////// FORM TO ADD EMAIL IN LIST
    <?php
    if(isset($_POST['m1']))
    {
    // CHECK EMAIL
    if (!ereg("(^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$)", $_POST['email'], $adress ))
    {
    $_rerror= "Valid email please";
    }
    // CHECK IF EMAIL EXIST
    $_emaillist=file("email.txt");
    if(in_array($_POST['email'],$_emaillist))
    {
    $_rerror= "Sorry email already in list";
    }

    if(empty($_rerror))
    {
    $fpq = @fopen("email.txt", 'a');
    @fwrite($fpq, $_POST['email']."\n");
    @fclose($fpq);
    $_allareok="Thanks for submit ";
    }

    }
    ?>
    <?=$_allareok;?>
    <form action="" method="post" enctype="application/x-www-form-urlencoded">
    <input type="text" name="email" size="50" maxlength="150" /><?=$_rerror;?>
    <p><input type="submit" name="m1" value="submit" /></p>
    </form>

    //////////////// RAND SCRIPT DISPLAY EMAIL FROM LIST
    <?php
    $_emailn=file("email.txt");
    for($i = 0; $i < 1; $i++)
    {
    srand((double)microtime()*1000000); // randomize
    $_n = (rand(1, sizeof($_emailn)) - 1); //Pick random qoute
    echo $_emailn[$_n];
    }
    ?>
     
    Estevan, Mar 11, 2007 IP
  8. Drew007

    Drew007 Peon

    Messages:
    310
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thanks! I will play around with this.
     
    Drew007, Mar 21, 2007 IP