Advertisement
Advertisement
| 01.28.2008 at 10:54AM PST, ID: 23117116 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: |
<?php
// basic sequence with LDAP is connect, bind, search, interpret search
// result, close connection
$uname = "cfusion";
$pass = "cfusion";
echo "<h3>LDAP query test</h3>";
echo "Connecting ...";
$ds=ldap_connect("dc01.ad.my_companies_domain.org"); // must be a valid LDAP server!
echo "connect result is " . $ds . "<br />";
$base_dn = "DC=ad, DC=chsnj, DC=org";
if ($ds) {
echo "Binding ...";
$r=ldap_bind($ds, $uname, $pass); // this is an "anonymous" bind, typically
if ($r) {
echo "LDAP bind successful...";
} else {
echo "LDAP bind failed...";
}
echo "Bind result is " . $r . "<br />";
echo "Searching for (sn=S*) ...";
// Search surname entry
$sr=ldap_search($ds, "OU=Users, OU=Officers, ".$basedn, "CN=Meyer");
if ($sr) {
echo "LDAP search successful...";
} else {
echo "LDAP search failed...";
}
echo "Search result is " . $sr . "<br />";
echo "Number of entires returned is " . ldap_count_entries($ds, $sr) . "<br />";
echo "Getting entries ...<p>";
$info = ldap_get_entries($ds, $sr);
echo "Data for " . $info["count"] . " items returned:<p>";
for ($i=0; $i<$info["count"]; $i++) {
echo "dn is: " . $info[$i]["dn"] . "<br />";
echo "first cn entry is: " . $info[$i]["cn"][0] . "<br />";
echo "first email entry is: " . $info[$i]["mail"][0] . "<br /><hr />";
}
echo "Closing connection";
ldap_close($ds);
} else {
echo "<h4>Unable to connect to LDAP server</h4>";
}
?>
|