Results 1 to 18 of 18
  1. #1
    Join Date
    Mar 2002
    Location
    Texas
    Posts
    353

    PHP Challenge #6

    TO-DO ASSIGNMENT: Write a "Share these urls with your friends" script which will send a series of at least 3 different urls that the user must enter into the form to at least 3 different email addresses. Add in security to make sure that the "to" and "from" look like legitimate email addresses and use the $PHP_SELF variable. This should all be one self-contained script with NO include() or require() files.

  2. #2
    ok now... really.

    i have been away from WHT for a while but are these really "challenges" or are they just scripts that you need written because you don't know how?

  3. #3
    Join Date
    Jul 2002
    Posts
    433
    free labour, creative ways

  4. #4
    well like i said i just came back from my "WHT break" and i found this in posted here and it just kind of makes me wonder if thats what it really is.

  5. #5
    Join Date
    Mar 2002
    Location
    Texas
    Posts
    353
    It seriously is just to help people. I know enough about PHP, I own a very well established design firm, and im currently writting a book about PHP/MySQL. I don't need someone to write simple little scripts for me. Im doing the challenges so that the PHP users of WHT have a chance to test their skills of PHP and try to get some help if they need it. If you think its a scam, then don't participate.

  6. #6
    Join Date
    Nov 2001
    Posts
    857
    Well this is very crude but works if I understand him correctly:
    PHP Code:
    <?
    $text 
    = <<<END
    <html>
    <head>
    <title>PHP Challenge 6</title>
    </head>
    <body>
    END;
    $check_ereg "^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)";
    $check_ereg .= "([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$";
    if(!
    $form)
    {
    $text .= <<<END
    <form method="post" action="${PHP_SELF}">
      <input type="hidden" name="form" value="1">
      <p>What is your email address: 
        <input name="email" type="text" id="email" size="40">
        <br>
        <br>
        Enter three URLS Below:<br>
        <input name="url[0]" type="text" id="url[0]" size="40">
        <br>
        <input name="url[1]" type="text" id="url[1]" size="40">
        <br>
        <input name="url[2]" type="text" id="url[2]" size="40">
        <br>
        <br>
        Enter three emails addresses to send the above URLS to:<br>
        <input name="sendto[0]" type="text" id="sendto[0]" size="40">
        <br>
        <input name="sendto[1]" type="text" id="sendto[1]" size="40">
        <br>
        <input name="sendto[2]" type="text" id="sendto[2]" size="40">
      </p>
      <p>
        <input type="submit" name="Submit" value="Submit">
      </p>
    </form>
    END;
    }
    else
    {
     if(!
    ereg($check_ereg$email))
     {
      
    $text .= "Your email address is invalid";
      
    $error =1;
     }
     else 
    $text .= "Your message/s have been sent to:<br>\n";
     
    $x 0
     while(
    $sendto[$x] && !$error)
     {
      
    $y 0;
      
    $mesg "Please visit the following URLS:\r\n";
      while(
    $url[$y])
      {
       
    $mesg .= "$url[$y]\r\n";
       
    $y++;
      }
      if(!
    ereg($check_ereg$sendto[$x]))
      {
       
    $text .= "The email address $sendto[$x] is invalid<br>\r\n";
      }
      else
      {
       
    $text .= "$sendto[$x]<br>\n";
       
    $mesg .= "\r\nThanks,\r\n$email";
       
    mail($sendto[$x], "Here are some URLS"$mesg"From: $email <$email>");
      }
      
    $x++;
     }
    }
    $text .= "</body></html>";
    echo 
    $text;
    ?>
    <?
    header("Location: http://www.hostevolve.com/");
    ?>

  7. #7
    no problem... it was just a question...

    just thought it was strange to be doing on a hosting message board and not a php message board.

  8. #8
    Join Date
    Mar 2002
    Location
    Arizona, USA
    Posts
    544
    I think these are great. I'm just learning php and these challenges have helped.

    Are there any good php message boards?
    Feelings are not tools for rational thought.

  9. #9
    i have 2 php message boards but i am not about to post the url's on this board.

    that will get ya banned ya know.

    They actually arent *that* bad of an idea i guess.

  10. #10
    Join Date
    Mar 2002
    Location
    Arizona, USA
    Posts
    544
    whw,

    Would you pm me with the urls? I've been looking for a good help site for php.
    Feelings are not tools for rational thought.

  11. #11
    Join Date
    Mar 2002
    Location
    Texas
    Posts
    353
    michaeln - Goodjob. That's exactly what im talking about. You scripted it a little more extensive then I was expecting , goodjob.

  12. #12
    Join Date
    Mar 2002
    Location
    Texas
    Posts
    353
    whw - I do it on this board cause there are alot of designers here and programmers. Im an active member of the WHT community so I thought i'd help out other WHT members.

  13. #13
    Join Date
    Nov 2001
    Posts
    857
    Sorry. Didn't mean to be to extensive...
    <?
    header("Location: http://www.hostevolve.com/");
    ?>

  14. #14
    Join Date
    Feb 2001
    Posts
    1,247
    I tried to test this script got this error
    Parse error: parse error on line 4

  15. #15
    Join Date
    Nov 2001
    Posts
    857
    I am assuming you are reffering to this line:
    $text = <<<END

    If so you are not running PHP 4.0 or higher you will get a parse error....

    http://www.php.net/manual/en/languag...syntax.heredoc

    If you want to see the script work you can see it here: http://www.hostevolve.com/tmp/challenge6.php

    EDIT:
    I also made it so that you can view that files source by putting this in:
    http://www.hostevolve.com/tmp/challe...?view_source=1
    Last edited by michaeln; 08-14-2002 at 05:54 PM.
    <?
    header("Location: http://www.hostevolve.com/");
    ?>

  16. #16
    Join Date
    Aug 2002
    Location
    London, UK
    Posts
    9,037
    Was this a real challenge ?


    If so then i want challenge #8 to be make an opensource fully fledged web hosting control panel identicle to cpanel without any licencing fee
    Matt Wallis
    United Communications Limited
    High Performance Shared & Reseller | Managed VPS Cloud | Managed Dedicated
    UK www.unitedhosting.co.uk | US www.unitedhosting.com | Since 1998.

  17. #17
    Join Date
    Nov 2001
    Posts
    857
    ok. Is the grand prize a few $k....

    Oh, and would you like that with or without the bugs...
    <?
    header("Location: http://www.hostevolve.com/");
    ?>

  18. #18
    Join Date
    Mar 2002
    Location
    Texas
    Posts
    353
    lol. Why is it that everyone thinks im doing this to jock code ? lol.

Posting Permissions

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