Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/08/2010, 09:20
Dr_Chichi
 
Fecha de Ingreso: septiembre-2006
Mensajes: 330
Antigüedad: 18 años, 6 meses
Puntos: 2
Respuesta: problema con formulatio de contacto

RESTO AQUI

Código:
		
		if( ($form_nombre_len<=$nombre_min) && (!empty($form_nombre)) )
			$mensaje_error.=$mensaje_nombre_min;
		if( ($form_email_len<=$email_min)  && (!empty($form_email)) )
			$mensaje_error.=$mensaje_email_min;
		if( ($form_asunto_len<=$asunto_min) && (!empty($form_asunto)) )
			$mensaje_error.=$mensaje_asunto_min;
		if( ($form_mensaje_len<=$mensaje_min) && (!empty($form_mensaje)) )
			$mensaje_error.=$mensaje_mensaje_min;

	

		if($form_nombre_len>=$nombre_max)			
			$mensaje_error.=$mensaje_nombre_max;
		if($form_email_len>=$email_max)				
			$mensaje_error.=$mensaje_email_max;
		if($form_asunto_len>=$asunto_max)			
			$mensaje_error.=$mensaje_asunto_max;
		if($form_mensaje_len>=$mensaje_max)			
			$mensaje_error.=$mensaje_mensaje_max;

		
		if($adjunto_enviar==TRUE)
		{
			$archivo=$_FILES['form_archivo']['name'];		
			$temporal=$_FILES['form_archivo']['tmp_name'];		
		
			if($temporal!='')					
			{
				
				$adjunto_tamano=filesize($temporal)/1024;	
				if($adjunto_tamano>=$adjunto_max)
					$mensaje_error.=$mensaje_adjunto_max;
			}
		}
		else
			$temporal='';						

	
		if ((cuenta_letras_mayusculas($form_asunto)>$porcentaje_may_aceptadas) || (cuenta_letras_mayusculas($form_mensaje)>$porcentaje_may_aceptadas))
			$mensaje_error.=$mensaje_muchas_may;

	
		if( (censurar($form_asunto,$censura_lista)==FALSE) || (censurar($form_mensaje,$censura_lista)==FALSE) )
			$mensaje_error.=$mensaje_censura;

		if(empty($mensaje_error))			
		{
			
			$ip=ip();													
			setlocale (LC_TIME,$idioma);				
			$fecha=gmstrftime("%a, %d/%b/%y %H:%M:%S (%Z)",time());	
			$mensaje_texto=$form_mensaje."\n\n".$enviado_por.' '.$ip."\n".$enviado_el.' '.$fecha;

			
			if($temporal!='')
			{
			
				$buffer = implode("",file($temporal));		
				$buffer = chunk_split(base64_encode($buffer));	

			
				$cabecera = "MIME-version: 1.0\n";
				$cabecera .= "From: $form_nombre<$form_email>\n";
				$cabecera .= "Return-Path: $email_admin\n";
				$cabecera .= "Content-type: multipart/mixed; ";
				$cabecera .= "boundary=\"Message-Boundary\"\n";
				$cabecera .= "Content-transfer-encoding: 7BIT\n";
				$cabecera .= "X-attachments: $temporal";

			
				$mensaje = "--Message-Boundary\n";
				$mensaje .= "Content-type: text/plain; charset=ISO-8859-1\n";
				$mensaje .= "Content-transfer-encoding: 7BIT\n";
				$mensaje .= "Content-description: Mail message body\n\n";
				$mensaje .=$mensaje_texto;

			
				$mensaje .= "\n\n--Message-Boundary\n";
				$mensaje .= "Content-type: Binary; name=\"$archivo\"\n";
				$mensaje .= "Content-Transfer-Encoding: BASE64\n";
				$mensaje .= "Content-disposition: attachment; filename=\"$archivo\"\n\n";
				$mensaje .= "$buffer\n";
				$mensaje .= "--Message-Boundary--\n";
			}
			else
			{
				
				$cabecera = "From: $form_nombre<$form_email>\n";
				$cabecera .= "Return-Path: $email_admin\n";

			
				$mensaje = $mensaje_texto;
			}

			
			if (@mail($email_admin,$form_asunto,$mensaje,$cabecera))	
			{
				
				if($acuse_activo==TRUE)
				{
					
					if (@mail($form_email,$acuse_mail_asunto,$acuse_mail_cuerpo))	
						$salida=$acuse_mail_enviado;
					else	
						$salida=$acuse_mail_fallido;
				}
				else	
					$salida=$mensaje_mail_enviado;		
			}
			else		
				$salida=$mensaje_mail_fallido;		
		}
		else															
		{
			
			$mensaje_error=$mensaje_error_inicial.$mensaje_error.$mensaje_error_final;

			
			$salida=formulario($form_nombre,$form_email,$form_asunto,$form_mensaje,$mensaje_error);
		}
	}
	else															
		$salida=formulario();			

	return $salida;					
}


function limpiar($texto)
{
	$texto = trim($texto);				
	$texto = stripslashes($texto);			
	$texto = strip_tags($texto);			
	return $texto;					
}

function email_valido($email)
{
	if (preg_match('!^[a-z0-9.+-_]+@([a-z0-9-]+(?:.[a-z0-9-]+)+)$!i',$email,$partes))
	{
		
		if (!checkdnsrr($partes[1]))
			return FALSE;
		else
			return TRUE;
	}
	else
		return FALSE;
}


function ip()
{
	if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
	elseif (isset($_SERVER['HTTP_VIA']))
		$ip = $_SERVER['HTTP_VIA'];
	elseif (isset($_SERVER['REMOTE_ADDR']))
		$ip = $_SERVER['REMOTE_ADDR'];
	else
		$ip = 'desconocida';

	return $ip;					
}


function cuenta_letras_mayusculas($cadena)
{
	$string2=strtolower ($cadena);				
	similar_text ($cadena,$string2,$porcentaje); 		
	$porcentaje=100-$porcentaje;				
	return $porcentaje;
}


function censurar($texto,$filtro)
{
   	foreach ($filtro as $palabra)
	{
		if(eregi($palabra,$texto)!='')
			return FALSE;
	}
	return TRUE;
}


function formulario($form_nombre='',$form_email='',$form_asunto='',$form_mensaje='',$mensaje_error='')
{
	
	global $titulo_nombre,$titulo_email,$titulo_asunto,$titulo_mensaje;
	global $nombre_size,$email_size,$asunto_size,$mensaje_cols,$mensaje_rows;
	global $titulo_web,$mensaje_principal,$nombre_max,$email_max,$asunto_max;
	global $adjunto_enviar,$titulo_adjunto,$adjunto_max,$archivo_size;

	$url=$_SERVER['PHP_SELF'];		

	
	if($adjunto_enviar==TRUE)
	{
		$adjunto =<<<EOT
$titulo_adjunto<br />
<input type="file" name="form_archivo" size="$archivo_size" /><br />
EOT;
	}
	else
		$adjunto ='';

	$formulario =<<<EOT

$mensaje_error

<form enctype="multipart/form-data" method="post" action="$url">
<p>
<span class="style4">$titulo_nombre<br />
<input type="text" name="form_nombre" maxlength="$nombre_max" size="$nombre_size" value="$form_nombre" />
<br />
$titulo_email<br />
<input type="text" name="form_email" maxlength="$email_max" size="$email_size" value="$form_email" />
<br />
$titulo_asunto<br />
<input type="text" name="form_asunto" maxlength="$asunto_max" size="$asunto_size" value="$form_asunto" />
<br />
$titulo_mensaje</span><br />
<textarea cols="$mensaje_cols" rows="$mensaje_rows" name="form_mensaje">$form_mensaje</textarea><br />
<span class="style4">$adjunto</span><br />
<input type="submit" name="form_enviar" value="Enviar" />
</p>
</form>

EOT;

	return $formulario;						
}


function html($cuerpo)
{

	global $titulo_web;

	$pagina =<<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
		"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>$titulo_web</title>
<style type="text/css">
<!--
.style3 {	font-size: 14px;
	font-weight: bold;
	color: #FFFFFF;
}
.style4 {color: #FFFFFF}
-->
</style>
</head>
<body>
$cuerpo
</body>
</html>
EOT;

	return $pagina;
}


?>