<?
include "../libgkp.php";

$link = conectar();
$q = mysql_query("select distinct a.insti_codigo as id, b.correo as correo from persona_clave a, pers_correo b where a.pers_codigo = b.pers_codigo", $link);

$psd = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "x", "y", "z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
srand((float) microtime() * 10000000);

for($j=0;$fila=mysql_fetch_assoc($q);$j++){
	$pasd = array_rand($psd, 10);
	$cad="";
	for($i=0;$i < count($pasd);$i++){
 	$cad.=$psd[$pasd[$i]];
	}	
	mysql_query("insert into pwd (insti_codigo, correo, pwd, pwdmd5) values (".$fila['id'].", '".$fila['correo']."', '$cad', '".md5($cad)."')", $link);
	echo "{$fila['id']}\t\t$cad\t\t".md5($cad)."\n\r<br>";
}
?>