hahaha, me rio para no llorar
ahora llegan datos vacios
Código PHP:
<?php
include('functions.php');
if ($_POST['nombre']=='' || strlen($_POST['nombre'])<3)
{
$errors[] = 'Nomnbre debe poseer al menos 3 letras.';
}
if ($_POST['apellido']=='' || strlen($_POST['apellido'])<3)
{
$errors[] = 'Apellido debe poseer al menos 3 letras.';
}
if ($_POST['usuario']=='' || alpha_numeric($_POST['usuario'])==FALSE)
{
$errors[] = 'Usuario debe contener valores alfa-numéricos';
}
if ($_POST['pass']=='' || alpha_numeric($_POST['pass'])==FALSE)
{
$errors[] = 'A password is required and must be alpha-numeric';
}
if ($_POST['pass']!=$_POST['re_pass'])
{
$errors[] = 'The two passwords must match';
}
if (valid_email($_POST['mail'])==FALSE)
{
$errors[] = 'Please supply a valid email address';
}
if ($_POST['cedula']=='' || strlen($_POST['cedula'])<3)
{
$errors[] = 'Cedula name is required and must contain 3 characters or more';
}
if ($_POST['telefono']=='' || strlen($_POST['telefono'])<3)
{
$errors[] = 'Telefono name is required and must contain 3 characters or more';
}
if ($_POST['fecha']=='' || strlen($_POST['fecha'])<3)
{
$errors[] = 'Fecha name is required and must contain 3 characters or more';
}
if(is_array($errors))
{
echo '<p class="error"><b>The following errors occured</b></p>';
while (list($key,$value) = each($errors))
{
echo '<span class="error">'.$value.'</span><br />';
}
}
else {
include ('conect.php');
$query="INSERT INTO clientes SET
nombre = '$nombre',
apellido = '$apellido',
usuario = '$usuario',
pass = '$pass',
mail = '$mail',
cedula = '$cedula',
telefono = '$telefono',
fecha = '$fecha'";
mysql_query($query) or die( "[ERROR] Query: $query, error: " . mysql_error() );
echo '<p><b>Felicitaciones!</b></p>';
echo '<span>Tu registro ha sido procesado con éxito. Ahora puedes ingresar usando tu usuario y contraseña. gracias por registrarte !</span>';
}
?>