<html>
<head>
</head>
<body style="font-family:'Courier New', Courier, monospace">
<?php
	$odbcLab=odbc_connect("baseReyes","","");
	$con=mysqli_connect("localhost","root","castillejos");
	mysqli_select_db("azteca_reyes");	
	/*$sq_user=odbc_exec($odbcLab,"SELECT TOP 30 user.clave,user.nombre FROM demograf left join user on(user.clave=demograf.clave) order by no_consec");
	
	while($dt_user=odbcFetchArray($sq_user)){
		echo str_pad("$dt_user['clave']",10,"_",STR_PAD_RIGHT).":$dt_user['nombre']<br>";
	}*/
mysqli_query($con ,"delete from dlusunrlab");
$fp=fopen("c:\bases\ACceso.key","r");
while($data=fgets($fp,5040)){
	$clave =substr($data,0,6);
	$nombre=substr($data,16,20);	
	echo "$clave:$nombre <br>";
	mysqli_query($con ,"INSERT INTO dlusunrlab SET cve_usu='$clave', nom_usu='$nombre' ");	
}
	
function odbcFetchArray(&$res){    
    $i = 0;
    $j = 0;
	
    $toReturn = "";
    if(odbc_fetch_row($res)){
        for ($j = 1; $j <= odbc_num_fields($res); $j++){        
             $field_name = odbc_field_name($res, $j);
             $ar[$field_name] = trim(odbc_result($res, $field_name));
        }
   		return $ar;
	}else{
		return false;    
	}
}

?>
</body>
</html>
