title: Moodle external database login fails
body: <p>I have been trying this for external moodle login</p>
  
  <pre><code>   &lt;?php
  require('config.php');
  $name=$_REQUEST['name'];
  $password=$_REQUEST['password'];
  $dashboard = $CFG-&gt;wwwroot;
  $user = authenticate_user_login($name, $password);
  if(complete_user_login($user))
  {
  echo "login";
  }
  else
  {
     echo "not login";
  }
  ?&gt;
  </code></pre>
  
  <p>But this throws me some errors in a error page if the user or password is invalid.
  is there anyway that I can get the error as variable so that I can handle in code. The following function is doing that </p>
  
  <pre><code>$user = authenticate_user_login($name, $password);
  </code></pre>