School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store | FORUMS
Class / Forums / php101 ![]() |
Week #7 ADVANCED To-Do Assignment |
(#13 2003-08-07 16:46:54) Post Reply |
|
TDavid
|
TO-DO ASSIGNMENT: Go back to your advanced "send a url to a friend" mail script from course # 6 and add security so that only direct links from your domain and adultnetsurprise (so that we can check it out from the forum without the error popping up) can access the form and provide an error routine for those that try to come in from bookmark or type-in or illegal domain.
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!
|
(#81 2003-08-22 07:17:01) Post Reply |
|
Sk8rRIMuk
|
:) a nice script which I shall use to stop offsite linkings to my downlaods.
The working script URL is: http://www.katikai.com/ee/assi...rlemailform.php *Sk8rRIMuk crosses fingers that link from forums works As usual all my scripts can be found at: http://www.katikai.com/ee/assignment Heres the code for the page: |
(#184 2003-09-11 04:16:42) Post Reply |
|
Quicksaver
|
mah code, and again, im not sure if the mail function works properly, i couldnt test it yet, so if it doesnt, dont blame me on this forum but on week 6 basic and advanced forum please :)
working url |
(#185 2003-09-11 04:20:34) Post Reply |
|
Quicksaver
|
wait, there's a glitch:
thats the part i changed (lines 5, 6 and 7, the rest remains as well a the url |
(#239 2003-09-18 03:40:27) Post Reply |
|
Shrek
|
Here is My Week#7 Advanced Assignment
HTML http://members.lycos.co.uk/jef...an/class07a.htm PHP File to Send mail http://members.lycos.co.uk/jef...an/class07a.php Unauthorized URL Referer http://jeffkwan.150m.com |
(#240 2003-09-18 03:44:43) Post Reply |
|
Shrek
|
However, I have one security question. I can enter the send mail pages by pressing refresh rather than enter it thru the html files. What can I do to modify the code to improve the security?
|
(#241 2003-09-18 05:14:50) Post Reply |
|
Quicksaver
|
i dont have any advice for that, but if there is one i really think a very few people know it, because if you fill in a form, and then you click refresh at the result page, its like if youu filled it up again exactly, so for example, if you send some email to smeone, and you click refresh at the "email sent" page the email is sent again, and if you refresh again it's sent again, and again and again... i really never seen any script with that type of protection, there probably is some function to delete the values inserted from the memory, im also curious about this :) |
(#244 2003-09-18 05:50:13) Post Reply |
|
Shrek
|
so can I have any methods to erase the "hidden" value for that code?
Thx a lot |
(#254 2003-09-19 21:59:05) Post Reply |
|
logspirit
|
Use a header to redirect to an seperate 'script only' page to handle your mail() functions, then no browser back button can use it.
Look for an example of this from me soon... logspirit |
(#263 2003-09-22 05:35:13) Post Reply |
|
Quicksaver
|
logspirit, you got a point there but there's still the refresh button :P
anyway, here's my code, i had to change it due to some bug on week6advanced task
not entirely working url - reminder, the online server i use doesnt support the mail() function |
(#359 2003-11-04 07:05:34) Post Reply |
|
Dest
|
Here is only what i have changed in week6 assignment. was a little confusing work just because week6 had many if, else :) but anyway. working ENTER url:
http://tts.lt/~sir/scripts/week7adv.php |
(#360 2003-11-04 07:06:45) Post Reply |
|
Dest
|
oh i forgot.:
main script: http://tts.lt/~sir/scripts/week6adv.php |
(#361 2003-11-04 07:09:01) Post Reply |
|
Dest
|
if you press link from here, it dont work... in eregi i wrote .+scriptschool.+
whats wrong there ? |
(#362 2003-11-04 07:10:42) Post Reply |
|
Dest
|
oh it should be .+(scriptschool).+
sorry for that. now it works :D |
(#626 2004-06-08 16:19:42) Post Reply |
|
Ahkorahil
|
Here goes my homework after a long time...
<!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 $domain_1 = "http://members.lycos.co.uk/rain086/php/"; $domain_2 = "http://class.scriptschool.com/forums/php101/view/13/"; if($domain_1 OR $domain_2) { 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 } } else { print("Sorry, You are not allowed to fill this form"); } ?> </body> </html> |
(#784 2005-03-06 11:02:39) Post Reply |
|
zman
|
My Advanced Assignment #7:
|
(#834 2005-06-13 09:58:51) Post Reply |
|
vegyta2004
|
My week 7 advanced assignment:
<? if($HTTP_REFERER=="") {echo"ACCES DENIED";} elseif(($HTTP_REFERER=="http://www.vegyta.3x.ro")or($HTTP_REFERER=="http://www.adultnetsurprise.com")) { $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($recipients); $body=$_POST["body_of_email"]; $e=$_POST["from"]; $headers="FROM:$e r\n"; $size=count($recipients); for($i=0;$i<$c1;$i++){ $mas=$recipients[$i]; $bod=$url[$i]; if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)",$mas)) { if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)",$_POST["from"])) { if(mail($mas,"subiect",$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> <form method="POST" action="end.php"> 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"> <?}?> |
(#835 2005-06-14 05:22:01) Post Reply |
|
vegyta2004
|
My last corrections on this assignment(i'll post the script whit the corrections):
<? if(($HTTP_REFERER=="http://www.vegyta.3x.ro/")or($HTTP_REFERER=="http://www.vegyta.3x.ro/week7_avanced.php")) { ?> <br><br><br><br> <form method="POST" action="<?PHP_SELF?>"> 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"> <? $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($recipients); $body=$_POST["body_of_email"]; $e=$_POST["from"]; $headers="FROM:$e r\n"; $size=count($recipients); for($i=0;$i<$c1;$i++){ $mas=$recipients[$i]; $bod=$url[$i]; if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)",$mas)) { if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)",$_POST["from"])) { if(mail($mas,"subiect",$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");} } } else {echo"ACCES DENIED";echo"<br>","$HTTP_REFERER";} ?> |
(#973 2006-03-20 23:28:57) Post Reply |
|
Russell
|
thanks zman for the double eregi with OR bit
|
|
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