Error in the form of my web

0

Good evening  I have a problem with my form that when I send the message, I get "Sorry but there seems to be a problem with the data sent"

Try with the mail of my web and the one of gmail, and it happens the same ... Thanks

HTML:

    <form name="contactform" method="post" action="mail/gs_enviar.php">
<table>
<tr>
 <td valign="top">
  <label for="name">Nombre Y Apellido *</label>
 </td>
 <td valign="top">
  <input  type="text" name="name" maxlength="50" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="email">E-mail *</label>
 </td>
 <td valign="top">
  <input  type="text" name="email" maxlength="50" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="telefono">Telefono *</label>
 </td>
 <td valign="top">
  <input  type="text" name="telefono" maxlength="50" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="comunidad">Nombre de la Comunidad *</label>
 </td>
 <td valign="top">
  <input  type="text" name="comunidad" maxlength="30" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="usuario">Usuario del Panel *</label>
 </td>
 <td valign="top">
  <input  type="text" name="usuario" maxlength="30" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="pass">Contraseña del Panel *</label>
 </td>
 <td valign="top">
  <input  type="text" name="pass" maxlength="30" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="juegos">Seleccionar Juego *</label>
  </td> 
  <td valign="top">
          <select name="juegos">
<option>-- Seleccionar --</option>
<option>Counter Strike 1.6 100FPS</option>
<option>Counter Strike 1.6 300FPS</option>
<option>Counter Strike 1.6 500FPS</option>
<option>Counter Strike 1.6 1000FPS</option>
<option>Counter Strike GO - 64TICKRATE</option>
<option>Counter Strike GO - 128TICKRATE</option>
<option>Counter Strike Source - 64TICKRATE</option>
<option>Counter Strike Source - 128TICKRATE</option>
<option>Team Fortress Classic</option>
<option>SAMP</option>
<option>Left 4 Dead</option>
<option>Mu Online</option>
<option>Wow</option>
<option>Minecraft</option>
</select>
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="pagos">Formas de Pago *</label>
 </td>
 <td valign="top">
<select name="pagos">
<option>-- Seleccionar --</option>
<option>Rapipago</option>
<option>Pago Facil</option>
<option>Transferencia</option>
<option>Bapro</option>
<option>Cuenta Digital</option>
<option>Dinero Mail</option>
</select>
 </td>
</tr>

<tr>
 <td valign="top">
  <label for="branding">Quitar Branding 50$ (By rnkhost.net) *</label>
 </td>
  <td valign="top">
          <select name="branding">
<option>-- Seleccionar --</option>
<option>Si</option>
<option>No</option>
</select>
 </td>
</tr>
<tr>
<td valign="top">
  <label for="Cantidad Server">Cantidad Server *</label>
 </td>
 <td valign="top">
  <input  type="text" name="cantidad server" maxlength="30" size="30">
 </td>
 </tr>
<tr>
<td valign="top">
  <label for="Slot">Slot (ej. 12/18/36)*</label>
 </td>
 <td valign="top">
  <input  type="text" name="slot" maxlength="30" size="30">
 </td>
</tr>
<tr>
 <td valign="top">
  <label for="message">Mensaje *</label>
 </td>
 <td valign="top">
  <textarea  name="message" maxlength="1000" cols="25" rows="6"></textarea>
 </td>
</tr>
<tr>
 <td colspan="2">
 <br>
 <div class="g-recaptcha" data-sitekey="6LfrGS8UAAAAAM1aPxprLtJSdfrOxRa1A5icy_A6"></div>
 <br>
  <input type="submit" value="Enviar"></a>
 </td>
</tr>
</table>
</form>

PHP:

<?php
if(isset($_POST['email'])) {

    // 

    $email_to = "[email protected]";

    $email_subject = "Contacto desde Web - GameServer";

    function died($error) {

        // mensajes de error

        echo "Lo sentimos, hubo un error en sus datos y el formulario no puede ser enviado en este momento. ";

        echo "Detalle de los errores.<br /><br />";

        echo $error."<br /><br />";

        echo "Por favor corrija estos errores e inténtelo de nuevo.<br /><br />";
        die();
    }

    // Se valida que los campos del formulairo estén llenos

    if(!isset($_POST['name']) || 
        !isset($_POST['email']) ||
        !isset($_POST['telefono']) ||
        !isset($_POST['comunidad']) ||
        !isset($_POST['usuario']) ||
        !isset($_POST['pass']) ||
        !isset($_POST['juegos']) ||
        !isset($_POST['pagos']) ||
        !isset($_POST['branding']) ||
        !isset($_POST['message'])) {

        die('Lo sentimos pero parece haber un problema con los datos enviados.');

    }
 //En esta parte el valor "name"  sirve para crear las variables que recolectaran la información de cada campo

    $name = $_POST['name']; // requerido

    $email_from = $_POST['email']; // requerido 

    $telefono = $_POST['telefono']; // requerido

    $comunidad = $_POST['comunidad']; // requerido

    $usuario = $_POST['usuario']; // requerido

    $pass = $_POST['pass']; // requerido

    $juegos = $_POST['juegos']; // requerido

    $pagos = $_POST['pagos']; // requerido

    $branding = $_POST['branding']; // requerido

    $message = $_POST['message']; // requerido

    $error_message = "";//Linea numero 52;

//En esta parte se verifica que la dirección de correo sea válida 

   $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';

  if(!preg_match($email_exp,$email_from)) {

    $error_message .= 'La direccion de correo proporcionada no es valida.<br />';

  }

//En esta parte se validan las cadenas de texto

    $string_exp = "/^[A-Za-z .'-]+$/";

  if(!preg_match($string_exp,$name)) {

    $error_message .= 'El formato del nombre no es valido<br />';

  }

  if(strlen($message) > 2) {

    $error_message .= 'El formato del texto no es valido.<br />';

  }

  if(strlen($error_message) > 0) {

    die($error_message);

  }

//Este es el cuerpo del mensaje tal y como llegará al correo

    $email_message = "Contenido del Mensaje.\n\n";



    function clean_string($string) {

      $bad = array("content-type","bcc:","to:","cc:","href");

      return str_replace($bad,"",$string);

    }



    $email_message .= "Nombre: ".clean_string($name)."\n";

    $email_message .= "Email: ".clean_string($email_from)."\n";

    $email_message .= "Telefono: ".clean_string($telefono)."\n";
    $email_message .= "Comunidad: ".clean_string($comunidad)."\n";
 $email_message .= "Usuario: ".clean_string($usuario)."\n";
 $email_message .= "Password: ".clean_string($pass)."\n";
    $email_message .= "Juegos: ".clean_string($juegos)."\n";

    $email_message .= "Pagos: ".clean_string($pagos)."\n";
      $email_message .= "Branding: ".clean_string($branding)."\n";

    $email_message .= "Mensaje: ".clean_string($message)."\n";

//Se crean los encabezados del correo

$headers = 'From: '.$email_from."\r\n".

'Reply-To: '.$email_from."\r\n" .

'X-Mailer: PHP/' . phpversion();

@mail($email_to, $email_subject, $email_message, $headers);

?>



<!-- Mensaje de que fue enviado-->

Gracias! Nos pondremos en contacto contigo a la brevedad

<?php

}

?>
    
asked by Dario Leandro Lamas 14.09.2017 в 03:33
source

0 answers