title: How can I store my users' passwords safely?
body: <p>How much more safe is this than plain <a href="http://en.wikipedia.org/wiki/MD5" rel="noreferrer">MD5</a>? I've just started looking into password security. I'm pretty new to PHP.</p>
  
  <pre><code>$salt = 'csdnfgksdgojnmfnb';
  
  $password = md5($salt.$_POST['password']);
  $result = mysql_query("SELECT id FROM users
                         WHERE username = '".mysql_real_escape_string($_POST['username'])."'
                         AND password = '$password'");
  
  if (mysql_num_rows($result) &lt; 1) {
      /* Access denied */
      echo "The username or password you entered is incorrect.";
  } 
  else {
      $_SESSION['id'] = mysql_result($result, 0, 'id');
      #header("Location: ./");
      echo "Hello $_SESSION[id]!";
  }
  </code></pre>