<?php
$servername = "localhost";
$username = "poolteam";
$password = "GxpajuipQKLnfHlo";
$dbname = "test";
$salt = "G1x7p8a7j5p3Q7K7L4n8f0H0lo";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$sql = "SELECT username,password FROM users";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
	while($row = $result->fetch_assoc()) {
        $uid = $row["username"];
		$hash_md5 = hash('md5',$row["username"].$salt);
		//$decoder = md5($row["password"]);
		//echo $row["username"]. " - " . $row["password"]. " - " . $hash_md5 .  " - " .  $decoder . "<br>";
		$s2 = mysql_query("UPDATE users SET password = '".$hash_md5."' WHERE username = '".$uid."'");
    }
} else {
    echo "0 results";
}
$conn->close();
?>
<?php
/*$link = mysql_connect('localhost', 'poolteam', 'GxpajuipQKLnfHlo');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';

$q = "SELECT * FROM poolteam.users";
$s = mysql_query($q, $connection);
$salt = "G1x7p8a7j5p3Q7K7L4n8f0H0lo";
for ($i = 0; $i < mysql_num_rows($s); $i++) {
$uid = mysql_result($s, $i, "user_id");
$pass = mysql_result($s, $i, "password");
echo $pass."<br>";
//$s2 = mysql_query("UPDATE users SET password = MD5(CONCAT('".$pass."', '".$salt."')) WHERE user_id = '".$uid."'");
}
mysql_close($link);*/
?>