On Tue, Dec 17, 2002 at 09:59:39AM +0100, Stephan Elsner wrote:

> Hi there!

Hi,

> I noticed that mgd_get_topic(CONSTANT ID - 15 in my case) sometimes fails
> with "Object does not exist".
> But the object exists, it's my root topic.
> 
> This occurs after calling mgd_auth_midgard with a non existing or wrong
> username/password.

Have a look at
http://bugs.midgard-project.org/view_bug_advanced_page.php?f_id=0000243

> How can I prevent this?

I'm using the following code to code the username/login _before_ calling
mgd_auth_midgard.

function auth_hack_mysql($username, $password) {
  // Hack see #243 on http://bugs.midgard-project.org/
  $db = DB::connect(DB_DSN);

  if (DB::isError($db)) 
    trigger_error("Connection to database with dsn ".DB_DSN." failed,
".DB::errorMessage($db), E_USER_ERROR);

  $sql = sprintf("SELECT id FROM person WHERE username='%s' AND
password=ENCRYPT('%s', password)", $username, $password);
  $res = $db->query($sql);

  if (DB::isError($res))
    trigger_error("Query $sql failed, ".DB::errorMessage($res),
E_USER_ERROR);

  if ($res->numRows() != 1) {
    trigger_error("Login failed (username=$username,
password=$password)", E_USER_NOTICE);
    return FALSE;
  }
    
  $db->disconnect();

  return true;
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to