School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store | FORUMS
Class / Forums / php101 ![]() |
Week #6 Basic To-Do Assignment, post here |
(#10 2003-08-07 16:13:02) Post Reply |
|
TDavid
|
Week #6 Basic TO-DO ASSIGNMENT: Write a script to accept form input and send the comments to and from someone that is input via form, do not hardcode the recipient or the from address.
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 here. scriptname.php <-- script name Good luck to you!
|
(#77 2003-08-20 13:16:22) Post Reply |
|
Sk8rRIMuk
|
The URL to my woking script is:
http://www.katikai.com/ee/assi...t/emailform.php As usual all my past scripts can be found at: http://www.katikai.com/ee/assignment/ Here is my script:
I have started using Macromedia Homesite for three reasons: 1) It color codes all script so it easier to understand. 2) It types attributes for you which makes scripting a lot faster :). 3) It tells you of certain errors in your scripts. |
(#179 2003-09-10 05:01:56) Post Reply |
|
Quicksaver
|
i have a little problem, i know everything works fine before the mail() function, i couldnt test it completly because my server doesnt support the mail() funtion "for security reasons"... so could someone test it out for me please? thanks :)
not entirely working url :P |
(#229 2003-09-17 08:04:36) Post Reply |
|
Shrek
|
http://members.lycos.co.uk/jef...wan/class06.htm
I don't know what go wrong with my php. There are many strange character appered in my html. |
(#234 2003-09-18 01:09:19) Post Reply |
|
Shrek
|
Happy Happy Happy!!! I find out the answer now...
http://members.lycos.co.uk/jef...wan/class06.php In my last assignment, I use the name as class06.HTM rather than class06.PHP. When I rename it to class06.PHP, the scripts works. Waste a lot of time but gain a lot experience... |
(#256 2003-09-20 07:10:04) Post Reply |
|
Quicksaver
|
ok, i installed php on my local server, but when i tried to do the mail() function this came up:
how do i verify those settings at the php.ini file or how do i use the ini_set() funtion??? |
(#257 2003-09-20 09:30:26) Post Reply |
|
Shrek
|
Quicksaver,
Have U installed the mail server? For me, I am using Win98/Apache/PHP. In this config, I need to install a mail server from my home. I am now using ArGoSoft Mail Server. http://www.argosoft.com/applic...ver/default.asp Hope this can help u. |
(#261 2003-09-22 05:07:45) Post Reply |
|
Quicksaver
|
thanks shrek, now the mail() thingy works :)
i tested the basic assignement already and it works (to be honest i wasnt expecting it to work at the first try :P) but i have a lil bug on the advanced one. ill work on it but if i cant fix it, well you guys know what to do ;) |
(#280 2003-09-26 11:50:53) Post Reply |
|
Donnie
|
Here is the code for week 6 basic assignment. I believe it is right, but if I enter an invalid e-mail address for the sender, it seems that "@myisp.com" is added and it sends it. Link to script:
http://www.dandrenterprises.co...assignment6.php Here is the code. |
(#289 2003-09-27 02:20:21) Post Reply |
|
maddy
|
All done, I think. I can't post a working URL, becuase my public server seems to have domr issues with sendmail. It works fine on my private server though. :)
|
(#295 2003-10-01 10:36:45) Post Reply |
|
MarcusD79
|
Well, I am quite confused. I have taken the example scripts you put up and it does not seem to work for me. I have conntacted my service provider and I am able to use mail() function and I am running PHP 4.3.1. Very confused..maybe you have an idea? Here it is, or you can look at it on the Week #6 page, or I have it uploaded to:
http://www.fagfrat.com/phpclass/week6tda.php
and http://www.fagfrat.com/phpclass/week6td.php Here is one:
I do not even get errors, just a blank page. So, am I a duffus, or is it wrong? I also have a aformmail that currenty uses mail() that someone else built, and when I look in it I see ""mail($_send_to, $_subject, $mail, "Mime-Version: 1.0\r\nFrom: $_send_from\r\nContent-Type: multipart/mixed;\n boundary=\"$mime_delimiter\"\r\nContent-Disposition: inline");"" and it works. Well, Thanks MarcusD |
(#307 2003-10-10 12:27:15) Post Reply |
|
Quicksaver
|
there's an error on the board's code, could ya fix it TDavy so we can see whats missing on the code? :) |
(#313 2003-10-12 10:52:45) Post Reply |
|
jlk242
|
Heres my code, I think it might work, based on the fact that my server tells me I am not allowed to do this, as opposed to getting a parse error...
|
(#356 2003-11-03 12:09:24) Post Reply |
|
Dest
|
Ok after few looks to others works i made it. I was trying to make send() with loop but actually, loops sux... so i made that way:
working url: http://tts.lt/~sir/scripts/week6adv.php |
(#371 2003-11-09 09:14:03) Post Reply |
|
doublezero
|
well i tried the advanced to do assigment but than with 10 e-mail adresses. Anyway when i tried the script it looked like working because its sed that the mail was send succesfully but still there are some bugs in it and i never get any mail send :s whats wrong? www.dangerweb.be/allys/tellafriend.php
code ///////////////////////////////////////////////// <HTML> <BODY> <CENTER><H1>TELL A FRIEND ABOUT THIS WEBSITE</h1></center> <CENTER><FONT SIZE="3">Made by doublezero</font></center> <BR> <? if($action == "send_mail"){ $recipients = array('$mail1', '$mail2', '$mail3', '$mail4', '$mail5', '$mail6', '$mail7', '$mail8', '$mail9', '$mail10'); $sizeof = count($recipients); $subject = "Your friend , $naam tells your about a good site"; $bodyofmail = "Hi Your friend $naam is telling your by this e-mail about a good site that is located at the following url: www.dangerweb.be/allys His personal comment : $persad"; $additional_headers = "From:$fromwhon"; for($i = 0; $i < $sizeof; $i++) { if(mail($recipients[$i],$subject,$bodyofmail,$additional_headers)){ print("Tell a friend mail succesfully! send to $recipient[$i]"); } else { print("Error , something went wrong , mail not send"); } } } else { ?> <FORM METHOD="post" ACTION="<? $PHP_SELF ?>"> <INPUT TYPE="hidden" name="action" value="send_mail"> <TABLE border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="0"><TR><TD width="600" height="150"> <TABLE border="0" align="center" cellpadding="0" cellspacing="0"> <TR><TD>E-mail adres1:<INPUT TYPE="text" name="mail1" size="15"></td> <TD>E-mail adres6:<INPUT TYPE="text" name="mail6" size="15"></td></tr> <TR><TD>E-mail adres2:<INPUT TYPE="text" name="mail2" size="15"></td> <TD>E-mail adres7:<INPUT TYPE="text" name="mail7" size="15"></td></tr> <TR><TD>E-mail adres3:<INPUT TYPE="text" name="mail3" size="15"></td> <TD>E-mail adres8:<INPUT TYPE="text" name="mail8" size="15"></td></tr> <TR><TD>E-mail adres4:<INPUT TYPE="text" name="mail4" size="15"></td> <TD>E-mail adres9:<INPUT TYPE="text" name="mail9" size="15"></td></tr> <TR><TD>E-mail adres5:<INPUT TYPE="text" name="mail5" size="15"></td> <TD>Emailadres10:<INPUT TYPE="text" name="mail10" size="15"></td></tr> </table> </td></tr></table> <BR> Your name:<BR><INPUT TYPE="text" name="naam" size="15"><BR> Your e-mail adres<BR><INPUT TYPE="text" name="fromwho" size="15"><BR> Personal add:<BR><TEXTAREA name="persad" rows="5" cols="30"> |
(#391 2003-11-19 15:34:43) Post Reply |
|
zxrod
|
<html>
<body>
</body> </html> |
(#496 2004-02-05 11:31:26) Post Reply |
|
ScriptME
|
Won't Work. WHen I try to send if gives the error message 31 times.
|
(#497 2004-02-05 11:32:55) Post Reply |
|
ScriptME
|
Won't Work. WHen I try to send if gives the error message 31 times.
|
(#620 2004-06-06 09:16:44) Post Reply |
|
Ahkorahil
|
//// I have problem with this code below. It shows form in the webpage, but it won't give any error messages when I insert somthing wrong (e.g. e-mail address)
link to page is <a href="http://members.lycos.co.uk/rain086/php/6.php">here</a> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>6th assignment in pHp</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php if(action == "true"){ $subject = "Hello"; $header = "omg"; $body = "hello from $from to $to"; if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $to)) { if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $from)) { if(mail($to, $subject, $body, $header)) { print("Mail successfully sent!"); } else { print("Mail was not sent."); } } else { print("somthing wrong with address of sender"); } } else { print("something was wrong with address of recepient");} }else{ ?> <form method="post" action="<?php $PHP_SELF ?>"> <input type = "hidden" name = "action" value = "true"> To: <input type="text" name="to" value="" size="20"> <br> From: <input type = "text" name = "from" value = "" size = "20"> <br> <input type = "submit" value = "Send plz"> </form> <?php } ?> </body> </html> l> |
(#704 2004-10-04 13:09:58) Post Reply |
|
lestat
|
|
(#709 2004-10-05 13:45:10) Post Reply |
|
lestat
|
I cant seem to get the second email address to validate. Any suggestions?
non-working url http://www.timslan.com/scripts...k6/wk6basic.php |
(#712 2004-10-11 10:05:26) Post Reply |
|
lestat
|
Woot! Got it!Just needed a few days awya from code to get a mind reboot :P
Working URL: http://www.timslan.com/scripts...k6/wk6basic.php |
(#781 2005-03-06 10:58:28) Post Reply |
|
zman
|
My Basic Assignment #6:
|
(#829 2005-06-03 02:43:10) Post Reply |
|
vegyta2004
|
my code:
<? if($action=="mail") { if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)",$_POST["recipient"])) { if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $_POST["additional_headers"])) { if(mail($_POST["recipient"], $_POST[subject], $_POST["body_of_email"], $_POST["additional_headers"])) { print("mail successfully sent to $recipient"); } else { print("oops! something didn't work right above, check the syntax of your code"); } } } } else print("oops it appears like your email: $recipient is not in the correct format"); ?> <form method="POST" action="<?$_SERVER["PHP_SELF"]?>"> <input type="hidden"value="mail"> DESTINATAR<input type="text"name="recipient"> <br> <input type="text" name="subject"><br> <input type="text"name="body_of_email"><br> EXPEDITOR<input type="text"name="additional_headers"> <br> <input type="submit"> |
(#899 2005-11-26 13:00:21) Post Reply |
|
Gixboy
|
this is not the assignment because I don't tihnk the assignments for this lesson are useful at all. It does cover the concepts of the assignment though, and I hope ya'll tihnk it's ok. I made an application form instead of a spam bot. Here it is.
|
(#916 2005-12-30 23:45:03) Post Reply |
|
Dylan
|
This script seems to work just fine at my site:
http://www.algore.org/~admin/email.php
And the source code is below, I notice some differences between the way I went about it and the way other did, kind of fun to see how there's more than one way of doing things. |
(#951 2006-02-24 22:03:18) Post Reply |
|
anti
|
|
(#969 2006-03-20 05:35:18) Post Reply |
|
Russell
|
still no comments... will have to work those in when i start getting confused.
|
(#984 2006-03-29 15:51:02) Post Reply |
|
RealC
|
ive gone for the advanced assignment
i comes up with an error though when i try and run it Error: Parse error: parse error, unexpected $ in /home/sites/xazos.com/public_html/week6advanced.php on line 32 This is my script: <html> <body> <?php $url1 = '<a href=www.google.com>Google</a>'; $url2 = '<a href=www.av.com>AltaVista</a>'; $url3 = '<a href=www.ebay.co.uk>eBay</a>'; if($action == send_mail) { $recipients = array('$friendemail1', '$friendemail2', '$friendemail3'); $size = count($recipients); $subject = $name Has Sent You These Great URLs!; $body_of_email = $name has shared with you these great urls<br>$url1<br>$url2<br>$url3; $additional_headers = ; for($i = 0; $i < $size; $i++) { if(ereg(([[:alnum:].-]+)(@[[:alnum:].-]+.+), $recipients)) { if(mail($recipients, $subject, $body_of_email, $additional_headers)) { print(mail successfully sent to $recipients);} else { print(oops! something didn't work right above, check the syntax of your code);} } } ?> <h1>Share These URLs With Your Friends</h1><p> <form method=post action=<? $PHP_SELF ?>> <input type=hidden name=action value=send_mail> Your Name:<input type=text name=name><br> Your Email Address:<input type=text name=youremail><br> First Friends Email Address:<input type=text name=friendemail1><br> Second Friends Email Address:<input type=text name=friendemail2><br> Third Friends Email Address:<input type=text name=friendemail3><br> <input type=submit><input type=reset> </body> </html> |
(#985 2006-03-29 15:52:22) Post Reply |
|
RealC
|
oops wrong topic anyways
ive gone for the advanced assignment i comes up with an error though when i try and run it Error: Parse error: parse error, unexpected $ in /home/sites/xazos.com/public_html/week6advanced.php on line 32 This is my script: |
|
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