title: Logging in from an external script using moodle database
body: <p>I'm not trying to create a plugin for moodle, I'm simply creating an external script that checks the credentials a user enters into a form against the user table in a moodle database.</p>
  
  <p>Right now in the script, it the username matches, but the password doesn't. I've read some information about moodle using salting, but I'm still not getting any luck.</p>
  
  <p>I'm using something like this to check the password.</p>
  
  <pre><code>$salt = 'random string of chars found in config file';
  $password = md5($_POST['password'].$salt);
  $query = "SELECT * FROM `user` WHERE password = '$password';";
  ...
  </code></pre>
  
  <p>Any suggestions would be greatly appreciated.</p>