However, md5 is not exactly "fine" since it is crackable now. You're better of using SHA1 or one of the mhash functions.
A good rule of thumb is to use the username as a salt. It's easy, it's unique (well should be) and it's constant (well, should be).
A better hash function is:
$user = $_POST['username'];
$pass = $_POST['password'];
$pass = sha1(md5(substr($user, 0, 6) . $pass));
Now, that would require all your users to have an username of 6 characters or more. You could do one better and say that usernames are no shorter 8 characters in length and do something like:
$user = $_POST['username'];
$pass = $_POST['password'];
$pass = sha1( md5(substr($user, 0, 4)) . md5($pass) . md5(substr($user, 4, 4)) );
You can be as creative as you want when doing the encryption. You could go character by character and entangle them together. For example, if you never have a password of over 36 characters + the length of the username:
$hashUser = $user = $_POST['username'];
$pass = $_POST['password'];
$alpha = 'aBcdEfghiJklmNopqRstuvWxyz0123456789'; // Will be used later...
$max = strlen($pass); // # of characters in password
while(strlen($hashUser) < $max)
{
$hashUser .= $alpha;
}
$plain = '';
for($i=0; $i<$max; $i++)
{
$plain .= $hashUser[$i] . $pass[$i];
if($i == $max-1)
$plain .= $hashUser[++$i];
}
$pass = sha1(md5($plain));
You can become more secure using the mhash library from PHP, or you can stick with the basics. I would suggest sha1 over md5 just because md5 can be cracked if tried. Sha1 has the issue of collisions (as does md5) so it's your choice. You can also look into crc32 or sha256 with the mhash function to reduce collisions and improve security.
[EDIT]
I updated the lower code, now it actually works and works well 😉