Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Edycja skryptu wysylki maila
Metalowy
post
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 26.10.2009

Ostrzeżenie: (0%)
-----


Witam serdecznie.
Wiec, ostatnio chcialem sobie zrobic na stronie formularz wysylajacy maila do mnie. A ze znam tylko html to polecialem ze zleceniem znalezienia skryptu do google. Wszystko ladnie fajnie dziala, ale teraz chce go edytowac jak zlikwidowac pola Full Name, Telephone Number i Your_Message. Bylbym wdzieczny za edycje. Pozdrawiam.




  1. <?php
  2. if(isset($_POST['Email_Address'])) {
  3.  
  4. include 'lite_settings.php';
  5.  
  6. if($email_to == "youremailaddress@yourdomain.com") {
  7. die("This message is for the Webmaster. Please enter your email address into the file 'lite_settings.php'");
  8. }
  9.  
  10. function died($error) {
  11. echo "Sorry, but there were error(s) found with the form your submitted. ";
  12. echo "These errors appear below.<br /><br />";
  13. echo $error."<br /><br />";
  14. echo "Please go back and fix these errors.<br /><br />";
  15. die();
  16. }
  17.  
  18. if(!isset($_POST['Full_Name']) ||
  19. !isset($_POST['Email_Address']) ||
  20. !isset($_POST['Telephone_Number']) ||
  21. !isset($_POST['Your_Message'])) {
  22. died('We are sorry, but there appears to be a problem with the form your submitted.');
  23. }
  24.  
  25. $full_name = $_POST['Full_Name']; // required
  26. $email_from = $_POST['Email_Address']; // required
  27. $telephone = $_POST['Telephone_Number']; // not required
  28. $comments = $_POST['Your_Message']; // required
  29.  
  30. $error_message = "";
  31. $email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";
  32. if(!eregi($email_exp,$email_from)) {
  33. $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  34. }
  35. if(strlen($full_name) < 2) {
  36. $error_message .= 'Your Name does not appear to be valid.<br />';
  37. }
  38. if(strlen($comments) < 2) {
  39. $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  40. }
  41.  
  42. if(strlen($error_message) > 0) {
  43. died($error_message);
  44. }
  45. $email_message = "Form details below.\r\n";
  46.  
  47. function clean_string($string) {
  48. $bad = array("content-type","bcc:","to:","cc:","href");
  49. return str_replace($bad,"",$string);
  50. }
  51.  
  52. $email_message .= "Full Name: ".clean_string($full_name)."\r\n";
  53. $email_message .= "Email: ".clean_string($email_from)."\r\n";
  54. $email_message .= "Telephone: ".clean_string($telephone)."\r\n";
  55. $email_message .= "Message: ".clean_string($comments)."\r\n";
  56.  
  57. $headers = 'From: '.$email_from."\r\n".
  58. 'Reply-To: '.$email_from."\r\n" .
  59. 'X-Mailer: PHP/' . phpversion();
  60. @mail($email_to, $email_subject, $email_message, $headers);
  61. header("Location: $thankyou");
  62. ?>
  63. <script>location.replace('<?php echo $thankyou;?>')</script>
  64. <?
  65. }
  66. ?>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 16:48