In the ldap script below i get the results when i use the decide function at the 
bottom.
Anyone have a tip on how i can change this so i can push the results into variables 
instead?

Thanks in advance

//Johan

<?php
function printarray ($what, $display, $info, $i) {
     for ($j=0; $j < (count($info[$i]["$what"]) -1); $j++) {
          $show = ereg_replace("\\$", "<BR>", $info[$i]["$what"][$j]);
          echo "$display: " . $show . "<br>";
    }
}
function decide ($what, $display, $info, $i) {
    if (gettype($info[$i]["$what"]) == "array") {
        printarray("$what", "$display", $info, $i);
    } else {
        echo "$display: ". $info[$i]["$what"] . "<br>";
    }
}

echo "<h3>LDAP query test</h3>";
echo "Connecting ...";
$ds=ldap_connect("server");

$dn = "o=Name, c=SV";
$filter="(|(uid=$user))";
$justthese = array( "ou", "sn", "givenname", "mail" , "cn", "department", "uid");

$sr=ldap_search($ds, $dn, $filter, $justthese);

$info = ldap_get_entries($ds, $sr);

print $info["count"]." entries returned<p>";


for ($i=0; $i<$info["count"]; $i++) {
decide("cn", "I am", $info, $i);
decide("mail", "Email address", $info, $i);
decide("uid", "Signum", $info, $i);
decide("department", "Avdelning", $info, $i);
}

?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to