<?


include ('logue.php');
include ('entete2.php');


$req = "SELECT id, login FROM matgraph_users WHERE id = idjoueur";
$res = mysql_query($req) or die('Erreur SQL! <br>'.$req.'<br>'.mysql_error());
$num = mysql_num_rows($res);
if ( $num > 0 ) {

	while( $row = mysql_fetch_array($res) ) {

		$req2 = "SELECT idjoueur FROM matgraph_hash WHERE idjoueur = ".$row['id'];
		$res2 = mysql_query($req2) or die('Erreur SQL! <br>'.$req2.'<br>'.mysql_error());

		if( $row2 = mysql_fetch_array($res2) ) {
			// Ben on fait rien
		} else {

			$req3 = "INSERT INTO matgraph_hash (idjoueur, login_hash) VALUES ('".
				$row['id']."', '".md5($row['login'])."')";
			$res3 = mysql_query($req3) or die('Erreur SQL! <br>'.$req3.'<br>'.mysql_error());
		}

	}

}

echo "Fini";

?>