22/08/2014, 14:02
|
| | Fecha de Ingreso: mayo-2014 Ubicación: Valencia
Mensajes: 63
Antigüedad: 10 años Puntos: 0 | |
Validación recaptcha Tengo el siguiente código, el captcha me sale correctamente, pero no se donde y como poner la validación. Ahora mismo ignora por completo el captcha, vamos, me sale pero da igual que lo rellene bien, mal o no lo rellene, el formulario se envía igualmente.
¿Alguna ayuda?
Pongo el código en varios mensajes, que no me deja en uno solo.
Gracias. Código PHP: <?php require_once('Connections/conexion.php'); ?> <?php require_once('includes/funciones.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_conexion, $conexion); //$query_DatosCentros = "SELECT * FROM tblcentro ORDER BY tblcentro.refProvincia ASC, tblcentro.strLocalidad ASC , strNombre ASC"; $query_DatosCentros = "SELECT tblcentro.*,tblprovincias.provincia, tblprovincias.id FROM tblcentro Inner Join tblprovincias ON tblcentro.refProvincia = tblprovincias.id ORDER BY tblprovincias.provincia ASC, tblcentro.strLocalidad ASC, tblcentro.strNombre ASC"; $DatosCentros = mysql_query($query_DatosCentros, $conexion) or die(mysql_error()); $row_DatosCentros = mysql_fetch_assoc($DatosCentros); $totalRows_DatosCentros = mysql_num_rows($DatosCentros); $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formulario")) { $insertSQL = sprintf("INSERT INTO tblusuarios (strNombre, strApellidos, strEspecialidad, intCentro, strEmail, intTelefono, strMensaje, intOrigen) VALUES (%s, %s, %s, %s, %s, %s, %s, 0)", GetSQLValueString($_POST['strNombre'], "text"), GetSQLValueString($_POST['strApellidos'], "text"), GetSQLValueString($_POST['strEspecialidad'], "text"), GetSQLValueString($_POST['intCentro'], "int"), GetSQLValueString($_POST['strEmail'], "text"), GetSQLValueString($_POST['intTelefono'], "text"), GetSQLValueString($_POST['strMensaje'], "text")); mysql_select_db($database_conexion, $conexion); $Result1 = mysql_query($insertSQL, $conexion) or die(mysql_error()); $insertGoTo = "profesores-registro-ok.php"; /*if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; }*/ $query_DatosCentros2 = "SELECT strNombre, strLocalidad, tblprovincias.provincia, tblprovincias.id FROM tblcentro Inner Join tblprovincias ON tblcentro.refProvincia = tblprovincias.id WHERE intCentro = '" . $_POST['intCentro'] . "'"; $DatosCentros2 = mysql_query($query_DatosCentros2, $conexion) or die(mysql_error()); $row_DatosCentros2 = mysql_fetch_assoc($DatosCentros2); $totalRows_DatosCentros2 = mysql_num_rows($DatosCentros2); header(sprintf("Location: %s", $insertGoTo)); $asunto = 'Formulario de Contacto Enviado desde profesores registrados'; $destinatario = '[email protected]'; $mensaje = "Hola admin,<br />"; $mensaje .= "se ha enviado un formulario de contacto desde profesores resgistrados con lo siguientes datos:<br /><br />"; $mensaje .= "- Nombre: ".$_POST['strNombre']."<br />"; $mensaje .= "- Apellidos: ".$_POST['strApellidos']."<br />"; $mensaje .= "- Especialidad: ".$_POST['strEspecialidad']."<br />"; $mensaje .= "- Provincia: ".$row_DatosCentros2['provincia'] ."<br />"; $mensaje .= "- Localidad: ".$row_DatosCentros2['strLocalidad'] ."<br />"; $mensaje .= "- Centro: ".$row_DatosCentros2['strNombre'] ."<br />"; $mensaje .= "- Telefono: ".$_POST['intTelefono']."<br />"; $mensaje .= "- Email: ".$_POST['strEmail']."<br />"; $mensaje .= "- Mensaje: ".nl2br($_POST['strMensaje'])."<br /><br />"; EnviarCorreoHTML($destinatario,$asunto,utf8_decode($mensaje)); } ?> <?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['emailacceso'])) { $loginUsername=$_POST['emailacceso']; $password=$_POST['passwordacceso']; $MM_fldUserAuthorization = "intNivelAcceso"; $MM_redirectLoginSuccess = "archivos-listado.php"; /*"profesores-registrados.php";*/ $MM_redirectLoginFailed = "profesores-acceso-nok.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_conexion, $conexion); $LoginRS__query=sprintf("SELECT intId, strNombre, strEmail, strPassword, intNivelAcceso FROM tblusuarios WHERE strEmail=%s AND strPassword=md5(%s) && intActivo=1", GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); $LoginRS = mysql_query($LoginRS__query, $conexion) or die(mysql_error()); $row_LoginRS = mysql_fetch_assoc($LoginRS); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = mysql_result($LoginRS,0,'intNivelAcceso'); if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();} //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername;/* EMail*/ $_SESSION['MM_UserGroup'] = $loginStrGroup;/* Nivel aacceso */ $_SESSION['MM_Nombre'] = $row_LoginRS['strNombre'];/*Nombre Usuario */ $_SESSION['MM_Id'] = $row_LoginRS['intId'];/*Id Usuario */ /*echo $_SESSION['MM_Username']; echo $_SESSION['MM_UserGroup']; echo $_SESSION['MM_Nombre'];*/ if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?> <!DOCTYPE html> <html lang="es"><!-- InstanceBegin template="/Templates/Principal.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title>xxx.es</title> <meta name="description" content=""> <meta name="robots" content="index, follow"> <!-- InstanceEndEditable --> <meta charset="utf-8"> <?php include("includes/precabecera.php"); ?> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> </head> <body> <!-- InstanceBeginEditable name="EditRegion3" --> <?php $menuseleccionado = 6;?> <section class="bg1"> <!--==============================header=================================--> <header id="header"> <div class="container_12"> <?php include("includes/cabecera.php"); ?> <?php //include("includes/slider.php"); ?> <?php include("includes/menu.php"); ?> </div> </header> |