I have done some little Modification to get this to work.
The following has to be changed:
##File: inc/auth.php
Add following Lines after:
if (ENCRYPT_PASS) {
$password = md5($password);
}
//XXX MY IMPLEMENTATION OF LDAP AUTH
$dsn = 'ldap://example.com:389/dc=exp,dc=com?uid?';
require_once 'LDAPauth.php';
$myauth =& new LDAPauth($dsn);
if ( !$myauth->login($username,$password) ) {
return 0;
} else {
$ud = $myauth->getData();
// check if user in table
$sql = "SELECT COUNT(login) FROM
".TBL_AUTH_USER." where login='".$username."'";
if ( $db->getOne($sql) == 0 ) {
// Add user to AUTH_TABLE
$mynextid = $db->nextId(TBL_AUTH_USER);
$sql = "INSERT INTO
".TBL_AUTH_USER."
(user_id,login,first_name,last_name,email,active)
VALUES('".$mynextid."','".$username."','".$ud['first_name']."','".$ud['last_name']."','".$ud['email']."','1')";
$db->query($sql);
$db->query("insert into
".TBL_USER_GROUP.
" (user_id, group_id, created_by, created_date)
select $mynextid, group_id, 0, ".time()."
from ".TBL_AUTH_GROUP.
" where group_name = 'User'");
$db->query("insert into ".TBL_USER_PREF."
(user_id) values ($mynextid)");
}
}
// this is phpbt code a little modified
$u = $db->getRow("select * from ".TBL_AUTH_USER." where
login = '$username' and active > 0");
//$u = $db->getRow("select * from ".TBL_AUTH_USER."
where login = '$username' and password = '$password' and
active > 0");
//END LDAP IMPLEMENTATION
Logged In: YES
user_id=715607
I have done some little Modification to get this to work.
The following has to be changed:
##File: inc/auth.php
Add following Lines after:
if (ENCRYPT_PASS) {
$password = md5($password);
}
//XXX MY IMPLEMENTATION OF LDAP AUTH
$dsn = 'ldap://example.com:389/dc=exp,dc=com?uid?';
require_once 'LDAPauth.php';
$myauth =& new LDAPauth($dsn);
if ( !$myauth->login($username,$password) ) {
return 0;
} else {
$ud = $myauth->getData();
// check if user in table
$sql = "SELECT COUNT(login) FROM
".TBL_AUTH_USER." where login='".$username."'";
if ( $db->getOne($sql) == 0 ) {
// Add user to AUTH_TABLE
$mynextid = $db->nextId(TBL_AUTH_USER);
$sql = "INSERT INTO
".TBL_AUTH_USER."
(user_id,login,first_name,last_name,email,active)
VALUES('".$mynextid."','".$username."','".$ud['first_name']."','".$ud['last_name']."','".$ud['email']."','1')";
$db->query($sql);
$db->query("insert into
".TBL_USER_GROUP.
" (user_id, group_id, created_by, created_date)
select $mynextid, group_id, 0, ".time()."
from ".TBL_AUTH_GROUP.
" where group_name = 'User'");
$db->query("insert into ".TBL_USER_PREF."
(user_id) values ($mynextid)");
}
}
// this is phpbt code a little modified
$u = $db->getRow("select * from ".TBL_AUTH_USER." where
login = '$username' and active > 0");
//$u = $db->getRow("select * from ".TBL_AUTH_USER."
where login = '$username' and password = '$password' and
active > 0");
//END LDAP IMPLEMENTATION
To get this work youll need following File to download:
http://www.valicek.de/ext_code_php.html,0960223841fb5b4b2cb4f67af817702b
Hope it helps. For me it works fine.