2002-11-15 08:25:24 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
// Authentication by looking up an external database table
|
|
|
|
|
2002-11-15 09:13:31 +00:00
|
|
|
// This code is completely untested so far - IT NEEDS TESTERS!
|
2002-11-15 08:25:24 +00:00
|
|
|
// Looks like it should work though ...
|
|
|
|
|
|
|
|
|
|
|
|
function auth_user_login ($username, $password) {
|
|
|
|
// Returns true if the username and password work
|
|
|
|
// and false if they are wrong or don't exist.
|
|
|
|
|
|
|
|
global $CFG;
|
|
|
|
|
2002-11-15 08:42:40 +00:00
|
|
|
ADOLoadCode($CFG->auth_dbtype);
|
2002-11-15 08:25:24 +00:00
|
|
|
$authdb = &ADONewConnection();
|
2002-11-15 08:42:40 +00:00
|
|
|
$authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname);
|
2002-11-15 08:25:24 +00:00
|
|
|
|
|
|
|
|
2002-11-15 08:42:40 +00:00
|
|
|
$rs = $authdb->Execute("SELECT * FROM $CFG->auth_dbtable
|
|
|
|
WHERE $CFG->auth_dbfielduser = '$username'
|
|
|
|
AND $CFG->auth_dbfieldpass = '$password' ");
|
2002-11-15 08:25:24 +00:00
|
|
|
if (!$rs) {
|
|
|
|
notify("Could not connect to the specified authentication database...");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $rs->RecordCount() ) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|