Ver Mensaje Individual
  #5 (permalink)  
Antiguo 28/05/2013, 13:30
Avatar de arcanisgk122
arcanisgk122
 
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 14 años, 5 meses
Puntos: 28
Respuesta: archivo PHP no se ejecuta sino que se descarga

y si pruebas con algo asi??

Código PHP:
Ver original
  1. <?php
  2. if(isset($_POST['email'])) {
  3.      
  4.     // EDIT THE 2 LINES BELOW AS REQUIRED
  5.     $email_to = "[email protected]";
  6.     $email_subject = "Your email subject line";
  7.      
  8.      
  9.     function died($error) {
  10.         // your error code can go here
  11.         echo "We are very sorry, but there were error(s) found with the form you 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.     // validation expected data exists
  19.     if(!isset($_POST['first_name']) ||
  20.         !isset($_POST['last_name']) ||
  21.         !isset($_POST['email']) ||
  22.         !isset($_POST['telephone']) ||
  23.         !isset($_POST['comments'])) {
  24.         died('We are sorry, but there appears to be a problem with the form you submitted.');      
  25.     }
  26.      
  27.     $first_name = $_POST['first_name']; // required
  28.     $last_name = $_POST['last_name']; // required
  29.     $email_from = $_POST['email']; // required
  30.     $telephone = $_POST['telephone']; // not required
  31.     $comments = $_POST['comments']; // required
  32.      
  33.     $error_message = "";
  34.     $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  35.   if(!preg_match($email_exp,$email_from)) {
  36.     $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  37.   }
  38.     $string_exp = "/^[A-Za-z .'-]+$/";
  39.   if(!preg_match($string_exp,$first_name)) {
  40.     $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  41.   }
  42.   if(!preg_match($string_exp,$last_name)) {
  43.     $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
  44.   }
  45.   if(strlen($comments) < 2) {
  46.     $error_message .= 'The Comments you entered do not appear to be valid.<br />';
  47.   }
  48.   if(strlen($error_message) > 0) {
  49.     died($error_message);
  50.   }
  51.     $email_message = "Form details below.\n\n";
  52.      
  53.     function clean_string($string) {
  54.       $bad = array("content-type","bcc:","to:","cc:","href");
  55.       return str_replace($bad,"",$string);
  56.     }
  57.      
  58.     $email_message .= "First Name: ".clean_string($first_name)."\n";
  59.     $email_message .= "Last Name: ".clean_string($last_name)."\n";
  60.     $email_message .= "Email: ".clean_string($email_from)."\n";
  61.     $email_message .= "Telephone: ".clean_string($telephone)."\n";
  62.     $email_message .= "Comments: ".clean_string($comments)."\n";
  63.      
  64.      
  65. // create email headers
  66. $headers = 'From: '.$email_from."\r\n".
  67. 'Reply-To: '.$email_from."\r\n" .
  68. 'X-Mailer: PHP/' . phpversion();
  69. @mail($email_to, $email_subject, $email_message, $headers);  
  70. ?>
  71.  
  72. <!-- include your own success html here -->
  73.  
  74. Thank you for contacting us. We will be in touch with you very soon.
  75.  
  76. <?php
  77. }
  78. ?>

http://www.freecontactform.com/email_form.php
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB