Código PHP:
// Compruebo que los datos existen en la base de datos
// conecto a la base de datos
require('conexion.php');
mysql_select_db("$base_datos",$con) or die (mysql_error());
$consulta = mysql_query("SELECT * FROM bandas WHERE validacion ='1'") or die (mysql_error());
$filas_num = mysql_num_rows($consulta);
if($filas_num != 0){
// CAMBIO LAS CONTRASEÑAS
while( $row = mysql_fetch_array($consulta)){
// genero contraseñas
$number1 = rand(1,30);
$number2 = rand(1,300);
$palabras = array(
1 => "rock",
2 => "pop",
3 => "soul",
4 => "canary",
5 => "guitar",
6 => "banjo",
7 => "music",
8 => "piano",
9 => "organo",
10 => "xilophone",
11 => "rithm",
12 => "balada",
13 => "bajo",
14 => "violin",
15 => "violonchelo",
16 => "stevevai",
17 => "satriani",
18 => "pastorius",
19 => "wooten",
20 => "marlon",
21 => "rizk",
22 => "techno",
23 => "punk",
24 => "latin",
25 => "rizk",
26 => "techno",
27 => "instrumento",
28 => "industrial",
29 => "garage",
30 => "fusion",
);
$cadena = "$palabras[$number1]$number2";
// Codifico la contraseña x4
for ($i=1; $i<=4; $i++) {
$cadena = base64_encode($cadena);
}
$seleccionar = mysql_query("SELECT pass FROM tabla WHERE validacion='1'");
mysql_query("UPDATE tabla SET pass='$cadena' WHERE validacion='1'");
$contar = $contar + 1;
}
if(isset($contar)) echo "Número de consultas realizadas: $contar";
}else{
echo "No se ha podido cambiar las contraseñas";
}
SALUDOS