require_once("wpldap/inc/setup.php"); require_once("wpldap/inc/functions.php"); if (!$dn){ echo '
Nespravne volana funkcia
'; return; }; //////////////////////////////////////////////////////////// //sosanie dat z formulara + pustanie do ldap $item_count = $_GET["itemCount"]; $item_index = $_GET["item_index"]; $item_value = $_GET["item_value"]; //$dn = $_GET["itemDN"]; unset($itemIndex2); if ($debug){ for ($i=0; $i'."\n";
//potrebujeme natiahnut stare hodnoty, aby sme vedeli co sa maze, co sa meni a co sa nemeni
unset($attrList);
for ($i=0; $i
";
if ($lc) {
$ldapV3 = ldap_set_option($lc,LDAP_OPT_PROTOCOL_VERSION,3);
if ($debug) echo "ldap protocol v3 je [".$ldapV3."]
";
if ($debug) echo "Binding as [$ldapLogin:$ldapPwd]
";
if (@ldap_bind($lc, $ldapLogin, $ldapPwd)){
if ($debug) echo "Searching for ";
//$attr[]="*"; //sosame vsetky attribs, je to nastavene v $attrList
if ($debug){
echo "attrList[]=";
for ($i=0;$i
\n";
//$result=ldap_search($lc, $ldapDN, "(objectclass=*)", $atr, 0, $search_limit);
$result=@ldap_search($lc, $dn, $queryStr, $attrList, 0, 1); //just 1 record
if (!isset($result)){
echo "Zaznam $dn nenajdeny.
Pravdepodobne ho prave niekto zmazal.$brn";
return;
};
if ($debug) echo "Search result is ".$result."
";
if ($debug) echo "Number of entires returned is ".ldap_count_entries($lc,$result)."
";
if ($debug) echo "Getting entries ...
";
$info = ldap_get_entries($lc, $result);
if ($debug) echo "Data for ".$info["count"]." items returned:
\n";
if ($debug) echo "info[count] = ".$info["count"]."
";
if (ldap_count_entries($lc,$result)){
//ziskame zoznam attribs podla toho co mame zadane v setup.php/schema
//$attrList=getArraySlice($schema,0);
//attrList je pole a vyzera nejako takto: ("cn","sn","givenName",...)
//v tomto behu uz mame attrList nastaveny zo zaciatku scriptu
$attrString=implode(",",$attrList);
if ($debug) echo "attrString=[".$attrString."]$brn";
//attrString je string a vyzera nejako takto: "cn,sn,givenName,..."
//mohol by som to spucit do jedneho s nasledujucim prikazom, ale vyzeralo
//by to velmi hnusne a o par dni by som to urcite ani sam nepochopil
$attrValues=getRecordAttribList($info[0],$attrString);
//attrValues je pole a obsahuje vyplnene data v rovnakom poradi ako $attrList
} else {
echo "Zaznam nebol najdeny.
\n";
return;
};
unset($queryAdd); //for addings
unset($queryMod); //for modyfings ;)
//vyzera to ze add aj mod sa da robit naraz jednym prikazom, takze tieto dve polia
//asi spucim dokopy
unset($queryDel); //for deletings
for ($i=0; $i
";
echo "add:$brn";
if (is_array($queryAdd)) {
while (list ($key, $val) = each($queryAdd)) {
echo "$key => ";
for ($i=0; $i
";
echo "
mod:$brn";
if (is_array($queryMod)) {
while (list ($key, $val) = each($queryMod)) {
echo "$key => ";
for ($i=0; $i
";
echo "
del:$brn";
if (is_array($queryDel)) {
while (list ($key, $val) = each($queryDel)) {
echo "$key => ";
for ($i=0; $i
\nKontaktuje prosim administratora systemu.";
}; // if bind
if ($debug) echo "Closing connection";
ldap_close($lc);
} else {
echo "Nemozem sa pripojit k LDAP serveru na adrese $ldapServer:$ldapPort
\nKontaktuje prosim administratora systemu.";
};
?>