School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store | FORUMS
Class / Forums / php101 ![]() |
Week #6 ADVANCED To-Do Assignment, post here |
(#11 2003-08-07 16:15:08) Post Reply |
|
TDavid
|
Week #6 ADVANCED 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.
Post this assignment here so that we can offer comment/critique for you, but also post a URL to the working copy of the script and the complete source code of the script in your post. scriptname.php <-- script name Good luck to you!
|
(#79 2003-08-20 18:18:48) Post Reply |
|
Sk8rRIMuk
|
Man appart from Week 3 Advanced which I can't do properly this has got to be the hardest one I have done.
My freinds have 15 e-mails in there inbox thx to this script h3h3. Heres the URL to the working copy of the script: http://www.katikai.com/ee/assi...rlemailform.php As always you can find all my past projects at: http://www.katikai.com/ee/assignment In the usual style heer is my scripts code:
I keep forgeting to comment my code :( |
(#180 2003-09-10 07:15:47) Post Reply |
|
Quicksaver
|
here's where i stopped the other time, once again can someone test it for me since my server doesnt have the mail() function enabled "for [******] security reasons"? thanks :)
not entirely working url :P |
(#235 2003-09-18 01:39:32) Post Reply |
|
Shrek
|
Here is my Week#6 ADVANCED Assignment
http://members.lycos.co.uk/jef...an/class06a.php |
(#262 2003-09-22 05:24:51) Post Reply |
|
Quicksaver
|
finnaly, i tested it, it had a bug
not entirely working url - like i said, the uploaded file doesnt send emails because of the server, but i guarantee you it works :) |
(#290 2003-09-27 03:13:48) Post Reply |
|
maddy
|
Seems to work. Not quite sure.Relied heavily on the code already posted here, especially in validating the multiple email addresses. Can we get a "model" type answer for this? |
(#314 2003-10-12 11:01:22) Post Reply |
|
jlk242
|
Oopsy! I posted my code orginally to the basic section, I hope i don't get detention....
I think it might work in theory, but my server tells me I am not allowed to do this...it doesn't show a Parse, just a forbidden message. |
(#392 2003-11-19 16:13:03) Post Reply |
|
zxrod
|
I forgot to post a comment with my week 6 basic assignment. Oh well. This appears to work fine so yay!
<html> <body>
</body> </html> |
(#621 2004-06-06 15:34:50) Post Reply |
|
Ahkorahil
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>6th (advanced) assignment in pHp</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php if($action == "send_mail") { if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $f1)) { if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $f2)) { if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $f3)) { $get = array($f1, $f2, $f3); $size = count($get); $subject = "Url's"; $header = "oneman@hot.ee"; $body_of = "I send to You some links to watch:\n <a href =\"$u1\">url 1</a>\n <a href =\"$u2\">url 2</a> \n <a href =\"$u3\">url 3</a>"; for($a = 0; $a < $size; $a++) { if(mail($saaja[$a], $subject, $body_of, $header)) { print("Mail sent"); } else { print("recipient has been written wrong"); } } /// suleb FOR } else { print("freind3 is wrong"); } } else { print("freind2 is wrong"); } } else { print("freind 1 is wrong"); } }else { ?> <form method = "post" action = "<?php $PHP_SELF ?>"> <input type = "hidden" name= "action" value = "send_mail" /> To freind #1: <input type = "text" name="f1" value ="" size ="20" /><br /> To freind #2: <input type = "text" name = "f2" value = "" size = "20" /><br /> To freind #3: <input type = "text" name = "f3" value = "" size = "20" /><br /> URL #1: <input type = "text" name = "u1" value = "" size = "20" /><br /> URL #2: <input type = "text" name = "u2" value = "" size = "20" /><br /> URL #3: <input type = "text" name = "u3" value = "" size = "20" /><br /> <input type = "submit" value = "SEND" /> </form> <?php } ?> </body> </html>
// This advanced assignment was little bit easier, because I had lots of trouble with basic assignment :) |
(#622 2004-06-06 15:37:06) Post Reply |
|
Ahkorahil
|
Hello again,
I have very noobic question and I shame to say it, but how do I add working link to my assingment code when I post it in the forum ? thanks for help |
(#672 2004-07-18 20:58:12) Post Reply |
|
def
|
|
(#713 2004-10-12 11:49:51) Post Reply |
|
lestat
|
I am way stuck on getting my loop to work. This code only shows sending the mail - without validating the email. Just trying to get this to work before adding more code to it.
Any help would be appreciated! |
(#714 2004-10-12 14:39:12) Post Reply |
|
lestat
|
OK finished this. I'm sure it could be cleaned up a little. Please critique. Thanks!
Working url:http://www.timslan.com/scriptskewl/week6/wk6adv.php |
(#782 2005-03-06 11:00:02) Post Reply |
|
zman
|
My Advanced Assignment #6:
|
(#830 2005-06-07 05:29:32) Post Reply |
|
vegyta2004
|
My week 6 assignment
<? $recipients=array($_POST["email_1"],$_POST["email_2"],$_POST["email_3"]); $url=array($_POST["body_of_email_1"],$_POST["body_of_email_2"],$_POST["body_of_email_3"]); $c1=count($mail); $recipient=$_POST["recipient"]; $subject=$_POST["subject"]; $body=$_POST["body_of_email"]; $headers='FROM:$_POST["from"]\n'; $size=count($recipients); if($_POST["action"]=="mail"){ for($i=0;$i<$size;$i++){ $mas=$recipients[$i]; $bod=$url[$i]; if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)",$mas)) { if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)",$_POST["from"])) { if(mail($mas,$subject,$bod,$headers)) {print("mail(s) successfully sent to e-mail adress specified"); } else { print("error,your mail has not been sent");} } //close from else{echo"your from is invalid";} } //close mail else{print("oops it appears like your mail(s):is not in the correct format");} } } ?> <br><br><br><br><br> <form method="POST" action="<?PHP_SELF?>"> <input type="hidden" value="mail"name="action"> url1<input type="text"name="body_of_email_1"><br> e-mail1<input type="text"name="email_1"> <br> url2<input type="text"name="body_of_email_2"> <br> e-mail2<input type="text"name="email_2"><br> url3<input <input type="text"name="body_of_email_3"><br> e-mail3<input type="text"name="email_3"> <br> from<input type="text"name="from"><br> <input type="submit"> working url: [url] http://www.programare-me.as.ro\basic.php [/url] |
(#970 2006-03-20 07:16:14) Post Reply |
|
Russell
|
not pretty but it works. i should spend a bit more time on it but its late and im tired. thanks Sk8rRIMuk and Quicksaver.
|
|
View Previous Thread Print This Page |
School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store
Advertising
| Link To Us | Privacy
Copyright 2000-2002 Script School Productions / KMR
Enterprises
No part of this website may be reproduced, copied and/or distributed
in any medium
without express written permission