Forum

PHP+LDAP kulllanımı...
 
Bildirimler
Hepsini Temizle

PHP+LDAP kulllanımı yenı kayıt sorunu

2 Yazılar
2 Üyeler
0 Likes
442 Görüntüleme
(@ilhancicek)
Gönderiler: 180
Estimable Member
Konu başlatıcı
 

iyi günler

Sisteminde bulunan AD'deki misafir adındaki OU'ya php ile yazılmış bir arayüzden yeni kullanıcı oluşturmak istiyroum fakat her seferinde aşağıdaki hatayı alıyorum:

Normal
0

21

false
false
false

TR
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Normal Tablo";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}

Warning: ldap_bind() [function.ldap-bind< http://localhost/test/function.ldap-bind >]:Unable to bind to server: Strong(er) authentication
required in

C:\wamp\www\test\kayit.php on line 29

bu hata neden kaynaklanıyor olabilir. 

Kullanmıs oldugum kod asagıda:

 <?php
## From form
$CN = $_POST [ 'CN' ];
$givenName = $_POST [ 'givenName' ];
$SN = $_POST [ 'SN' ];
$mail = $_POST [ 'mail' ];
$Phone = $_POST [ 'Phone' ];
$pwdtxt = $_POST [ 'pwdtxt' ];

$AD_server = "x.x.x.x" ;
$AD_Auth_User = "[email protected]" ; //Administrative user
$AD_Auth_PWD = "Abc212+" ; //The password

$dn = 'CN=' . $CN . ',OU=Misafir,DC=x,DC=com' ;

## Create Unicode password
$newPassword = "\"" . $pwdtxt . "\"" ;
$len = strlen ( $newPassword );
$newPassw = "" ;

for( $i = 0 ; $i < $len ; $i ++) {
$newPassw .= "{$newPassword{$i}}\000" ;
}

## CONNNECT TO AD
$ds = ldap_connect ( $AD_server );
if ( $ds ) {
ldap_set_option ( $ds , LDAP_OPT_PROTOCOL_VERSION , 3 ); // IMPORTANT
$r = ldap_bind ( $ds , $AD_Auth_User , $AD_Auth_PWD ); //BIND

$ldaprecord [ 'cn' ] = $CN ;
$ldaprecord [ 'givenName' ] = $givenName ;
$ldaprecord [ 'sn' ] = $SN ;
$ldaprecord [ 'objectclass' ][ 0 ] = "top" ;
$ldaprecord [ 'objectclass' ][ 1 ] = "person" ;
$ldaprecord [ 'objectclass' ][ 1 ] = "organizationalPerson" ;
$ldaprecord [ 'objectclass' ][ 2 ] = "user" ;
$ldaprecord [ 'mail' ] = $mail ;
$ldaprecord [ 'telephoneNumber' ] = $Phone ;
$ldaprecord [ "unicodepwd" ] = $newPassw ;
$ldaprecord [ "sAMAccountName" ] = $CN ;
$ldaprecord [ "UserAccountControl" ] = "512" ;
//This is to prevent the user from beeing disabled. -->
http : //support.microsoft.com/default.aspx?scid=kb;en-us;305144

$r = ldap_add ( $ds , $dn , $ldaprecord );

} else {
echo "cannot connect to LDAP server at $AD_server." ;
}

?>

 

 
Gönderildi : 10/05/2012 16:18

(@mehmetyayla)
Gönderiler: 550
Honorable Member
 

Php'de 
ldap_connect diye bir global değişken var mı ?

 
Gönderildi : 08/07/2012 23:55

Paylaş: