praegune kellaaeg 19.06.2025 00:37:40
|
Hinnavaatlus
:: Foorum
:: Uudised
:: Ärifoorumid
:: HV F1 ennustusvõistlus
:: Pangalink
:: Telekavad
:: HV toote otsing
|
|
autor |
|
MoonAngel
HV vaatleja
liitunud: 08.12.2010
|
08.12.2010 15:04:45
LDAP Connection ei tööta |
|
|
See pole koolitöö ja ma tahtsin teada miks mu programm ei tööta, olen kõike vaadanud ja ikka ei tööta. Kood on mul lihtsalt enda arendamise jaoks tehtud.
<?php
function a($v,$t = false)
{
echo '<pre>';
print_r($v);
echo '</pre>';
if($t) die;
}
$D['host'] = '172.16.1.7';
$D['port'] = NULL; //NULL 636
$D['basedn'] = 'DC=emu,DC=ee';
$D['username'] = 'helen';
//$D['password'] = '';
$ds=ldap_connect($D['host'], $D['port']);
$dn="UID=".$D['username'].",OU=people,".$D['basedn'];
a($dn);
if ($bind=@ldap_bind($ds, $dn, 'passwd'))
{
a("Login correct");
}
else
{
a("Unable to bind to server.</br>");
a("msg:'".ldap_error($ds)."'</br>");#check if the message isn't: Can't contact LDAP server
#if it say something about a cn or user then you are trying with the wrong $dn pattern i found this by looking at OpenLDAP source code
#we can figure out the right pattern by searching the user tree
#remember to turn on the anonymous search on the ldap server
if ($bind=ldap_bind($ds))
{
$D['filter'] = "CN=*";
a($D);
if (!($search=@ldap_search($ds, $D['basedn'], $D['filter'])))
{
//a('1');
a("Unable to search ldap server");
a("msg:'".ldap_error($ds)."'</br>");#check the message again
}
else
{
//a('2');
$number_returned = ldap_count_entries($ds,$search);
$info = ldap_get_entries($ds, $search);
a("The number of entries returned is ". $number_returned."<p>");
for ($i=0; $i<$info["count"]; $i++)
{
a($info[$i]);
#look for your user account in this pile of junk and apply the whole pattern where you build $dn to match exactly the ldap tree entry
}
}
}
else
{
a("Unable to bind anonymously<br>");
a("msg:".ldap_error($ds)."<br>");
}
}
?>
|
|
tagasi üles |
|
 |
mark11
HV vaatleja
liitunud: 28.01.2006
|
08.12.2010 19:41:16
|
|
|
1) pane kood tagide vahele
2) mis asi täpsemalt ei tööta?
3) oeh
|
|
Kommentaarid: 1 loe/lisa |
Kasutajad arvavad: |
   |
:: |
0 :: |
0 :: |
1 |
|
tagasi üles |
|
 |
|
lisa lemmikuks |
|
|
sa ei või postitada uusi teemasid siia foorumisse sa ei või vastata selle foorumi teemadele sa ei või muuta oma postitusi selles foorumis sa ei või kustutada oma postitusi selles foorumis sa ei või vastata küsitlustele selles foorumis sa ei saa lisada manuseid selles foorumis sa võid manuseid alla laadida selles foorumis
|
|
Hinnavaatlus ei vastuta foorumis tehtud postituste eest.
|