Ver Mensaje Individual
  #3 (permalink)  
Antiguo 04/09/2016, 07:20
rafaxusirati
 
Fecha de Ingreso: julio-2010
Ubicación: Cerca Sitges (Barcelona)
Mensajes: 98
Antigüedad: 13 años, 10 meses
Puntos: 4
Respuesta: validar recaptcha y redirigir

Para simplificar el código anterior, añadí solo dos campos (nombre y email) Al validar redirige al código que adjunto a continuación (1f_ok.php)

Comentar, que este código funciona correctamente, pero al añadir el recaptcha en el código anterior, no ingresa los datos del formulario a la BD

Muchas gracias.


Código HTML:
Ver original
  1. <?php require_once('../Connections/contactos.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.  if (PHP_VERSION < 6) {
  7.    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.  }
  9.  
  10.  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.  switch ($theType) {
  13.    case "text":
  14.      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.      break;    
  16.    case "long":
  17.    case "int":
  18.      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.      break;
  20.    case "double":
  21.      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.      break;
  23.    case "date":
  24.      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.      break;
  26.    case "defined":
  27.      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.      break;
  29.  }
  30.  return $theValue;
  31. }
  32. }
  33.  
  34. mysql_select_db($database_contactos, $contactos);
  35. $query_Recordset1 = "SELECT * FROM contactos";
  36. $Recordset1 = mysql_query($query_Recordset1, $contactos) or die(mysql_error());
  37. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  38. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  39. ?>
  40.  
  41.  
  42.  
  43. <?
  44. $db=mysql_connect("dbxxxxxxxx","dbxxxxxx","xxxxx",$db);
  45.    mysql_select_db("dbxxxxxxxx",$db);
  46.  
  47. $nombre=$_POST[nombre];
  48.     $apellido=$_POST[apellido];
  49.     $ciudad=$_POST[ciudad];
  50.     $comunidad=$_POST[comunidad];
  51.         $nombre_usuario=$_POST[nombre_usuario];
  52.     $password=$_POST[password];
  53.     $mailcontacto=$_POST[mailcontacto];
  54.     $mail=$_POST[mail];
  55.     $telefono=$_POST[telefono];
  56.     $telefono2=$_POST[telefono2];
  57.     $provincia=$_POST[provincia];
  58.     $Pais=$_POST[Pais];
  59.     $clave=$_POST[clave];
  60.     $foto1 = $_FILES['foto1']['name'];
  61.     $ip=$_SERVER['REMOTE_ADDR'];
  62.     $prefijo = substr(md5(uniqid(rand())),0,10);
  63.  
  64.  
  65. $uniqueID = substr(md5(uniqid(rand())),0,10);
  66. $foto1=$uniqueID.".".substr($foto1,-3);
  67.  
  68.  
  69. // "directorio" es el directorio donde vas a subir la imagen.
  70. mysql_query("insert into contactos( foto1 , foto2 ,  foto3 ,  foto4 ,  foto5 , nombre_usuario , password , mail , mailcontacto , telefono , telefono2 , nombre , apellido , comunidad , ciudad , provincia , clave , ip )
  71. values('/imagenes/_spain_$foto1','$foto2/datos internos/fotos/ico_sin_foto.gif','$foto3/datos internos/fotos/ico_sin_foto.gif','$foto4/datos internos/fotos/ico_sin_foto.gif','$foto5/datos internos/fotos/ico_sin_foto.gif','$nombre_usuario','$password','$mail','$mailcontacto','$telefono','$telefono2','$nombre','$apellido','$comunidad','$ciudad','$provincia','$clave','$ip')",$db) or die("La clave introducida, ya existe. Elige otra");  
  72.  
  73. //ahora subamos la imagen, "directorio" es el directorio donde la vas a subir.
  74. $copy = copy($_FILES['foto1']['tmp_name'], "../imagenes/_spain_".$foto1);
  75.  
  76.  
  77. ?>
  78.  
  79.  
  80.  
  81.   </div>
  82.   <!-- end #container -->
  83. </div>
  84. </body>
  85. </html>
  86. <?php
  87. mysql_free_result($Recordset1);
  88. ?>