Ver Mensaje Individual
  #6 (permalink)  
Antiguo 05/07/2006, 02:36
Avatar de djreficul
djreficul
 
Fecha de Ingreso: julio-2006
Ubicación: Cork
Mensajes: 672
Antigüedad: 17 años, 10 meses
Puntos: 0
Kizás esto te interese...

Código PHP:
//FUNCION PARA ASEGURAR LA VALIDEZ DE UN DNI FACILITADO
function validadni ($dni) {
    
$nif=substr ($dni08)+0;
    
$letra=strtoupper (substr ($dni, -1));
    
$letranif_array=array ("T","R","W","A","G","M","Y","F","P","D","X","B","N","J","Z","S","Q","V","H","L","C","K","E","F");
    
$resto=$nif%23;
    if (
$letra==$letranif_array[$resto] && $nif!=0){
        return 
true;
    }else{
        return 
false;
    }
}
if (!isset (
$_POST['dni']) || trim($_POST['dni'])=="" || !validadni($_POST['dni'])) {
     
header("Location: dni.php");
     exit;

A ver si te sirve...