![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
29/04/2008, 07:34
|
![Avatar de leskolpykos](http://static.forosdelweb.com/customavatars/avatar185355_1.gif) | | | Fecha de Ingreso: junio-2007 Ubicación: Caracas
Mensajes: 96
Antigüedad: 17 años, 8 meses Puntos: 0 | |
Re: error crítico en código captcha para evitar spam esto es lo que coloqué y no hace absolutamente nada ![lloron](http://static.forosdelweb.com/fdwtheme/images/smilies/chillando.png) ni detecta si es correcto el codigo o no, ni guarda el mensaje del usuario ni nada deoxxxx porqueee? ![Neurótico](http://static.forosdelweb.com/fdwtheme/images/smilies/scared.png)
Código:
<?php require_once('../home/conexion.php'); ?>
<?php
extract($_POST);
session_start();
if(isset($_POST[content])) {
if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
// Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
unset($_SESSION['security_code']);
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO libro (id, usuario, email, mensaje) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['id'], "int"),
GetSQLValueString($_POST['usuario'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['mensaje'], "text"));
mysql_select_db($database_localhost);
$Result1 = mysql_query($insertSQL) or die(mysql_error());
$insertGoTo = "default.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
} else {
// Insert your code for showing an error message here
echo "<script>alert('Disculpa! el código de seguridad está incorrecto'); window.location='javascript:history.back()';</script>";
}
}
?>
|