Les agradecería mucho que me asistan en estooo, saludoooos!!!.
<---- CÓDIGO ---->>
Código PHP :
<?php
# Validate: String
function check_string($value, $low, $high, $mode, $optional)
{
if ( (strlen($value) == 0) && ($optional === true) ) {
return true;
} elseif ( (strlen($value) >= $low) && ($mode == 1) ) {
return true;
} elseif ( (strlen($value) <= $high) && ($mode == 2) ) {
return true;
} elseif ( (strlen($value) >= $low) && (strlen($value) <= $high) && ($mode == 3) ) {
return true;
} else {
return false;
}
}
# RegisterGlobals OFF
$FTGempresa = $_POST['empresa'];
$FTGnombre = $_POST['nombre'];
$FTGdireccion = $_POST['direccion'];
$FTGciudad = $_POST['ciudad'];
$FTGestado = $_POST['estado'];
$FTGcodigopostal = $_POST['codigopostal'];
$FTGtelefono = $_POST['telefono'];
$FTGemail = $_POST['email'];
$FTGenviar = $_POST['enviar'];
$FTGborrar = $_POST['borrar'];
# Fields Validations
$validationFailed = false;
/*
if ( (! check_string($FTGempresa, 1, 0, 1, false))) {
$validationFailed = true;
}
if ( (! check_string($FTGnombre, 1, 0, 1, false))) {
$validationFailed = true;
}
if ( (! check_string($FTGdireccion, 1, 0, 1, false))) {
$validationFailed = true;
}
if ( (! check_string($FTGciudad, 1, 0, 1, false))) {
$validationFailed = true;
}
if ( (! check_string($FTGestado, 1, 0, 1, false))) {
$validationFailed = true;
}
if ( (! check_string($FTGcodigopostal, 1, 0, 1, false))) {
$validationFailed = true;
}
if ( (! check_string($FTGtelefono, 1, 0, 1, false))) {
$validationFailed = true;
}
if ( (! check_string($FTGemail, 1, 0, 1, false))) {
$validationFailed = true;
}
if ( (! check_string($FTGenviar, 1, 0, 1, false))) {
$validationFailed = true;
}
if ( (! check_string($FTGborrar, 1, 0, 1, false))) {
$validationFailed = true;
}
*/
# Embed error page and dump it to the browser
$fileErrorPage = 'error.html';
if ($validationFailed == true) {
if (file_exists($fileErrorPage) === false) {
echo "The error page: <b>error.html</b> cannot be found on the server.";
exit;
}
$fileHandle = fopen ($fileErrorPage, "r");
$errorPage = fread ($fileHandle, filesize($fileErrorPage));
fclose ($fileHandle);
$errorPage = str_replace('<!--VALIDATIONERROR-->', $errorList, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:empresa-->', $FTGempresa, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:nombre-->', $FTGnombre, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:direccion-->', $FTGdireccion, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:ciudad-->', $FTGciudad, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:estado-->', $FTGestado, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:codigopostal-->', $FTGcodigopostal, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:telefono-->', $FTGtelefono, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:email-->', $FTGemail, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:enviar-->', $FTGenviar, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:borrar-->', $FTGborrar, $errorPage);
echo $errorPage;
exit;
}
# Email to Form Owner
$emailTo = '[email protected]';
$emailSubject = "Registro de distribuidores";
$emailBody = "$FTGempresa;$FTGnombre;$FTGdireccion;$FTGciudad;$FTGestado;$FTGcodigopostal;$FTGtelefono;$FTGemail";
#$emailBody = "empresa: $FTGempresa\n ;"
# . "nombre: $FTGnombre\n ;"
# . "direccion: $FTGdireccion\n ;"
# . "ciudad: $FTGciudad\n ;"
# . "estado: $FTGestado\n ;"
# . "codigopostal: $FTGcodigopostal\n ;"
# . "telefono: $FTGtelefono\n ;"
# . "email: $FTGemail\n "
# . "\n"
# . "";
$emailHeader = "From: $FTGemail"
. "Reply-To: $FTGemail"
. "Content-type: text/plain; charset=\"ISO-8859-1\"\n"
. "Content-transfer-encoding: quoted-printable;\n";
mail($emailTo, $emailSubject, $emailBody, $emailHeader);
# Embed success page and dump it to the browser
$fileSuccessPage = 'registrosuccess.html';
if (file_exists($fileSuccessPage) === false) {
echo 'The success page: <b>registrosuccess.html</b> cannot be found on the server.';
exit;
}
$fileHandle = fopen ($fileSuccessPage, "r");
$successPage = fread ($fileHandle, filesize($fileSuccessPage));
fclose ($fileHandle);
$successPage = str_replace('<!--FIELDVALUE:empresa-->', $FTGempresa, $successPage);
$successPage = str_replace('<!--FIELDVALUE:nombre-->', $FTGnombre, $successPage);
$successPage = str_replace('<!--FIELDVALUE:direccion-->', $FTGdireccion, $successPage);
$successPage = str_replace('<!--FIELDVALUE:ciudad-->', $FTGciudad, $successPage);
$successPage = str_replace('<!--FIELDVALUE:estado-->', $FTGestado, $successPage);
$successPage = str_replace('<!--FIELDVALUE:codigopostal-->', $FTGcodigopostal, $successPage);
$successPage = str_replace('<!--FIELDVALUE:telefono-->', $FTGtelefono, $successPage);
$successPage = str_replace('<!--FIELDVALUE:email-->', $FTGemail, $successPage);
$successPage = str_replace('<!--FIELDVALUE:enviar-->', $FTGenviar, $successPage);
$successPage = str_replace('<!--FIELDVALUE:borrar-->', $FTGborrar, $successPage);
echo $successPage;
exit;
# End of PHP script
?> 