本文整理汇总了PHP中adLDAP::all_groups方法的典型用法代码示例。如果您正苦于以下问题:PHP adLDAP::all_groups方法的具体用法?PHP adLDAP::all_groups怎么用?PHP adLDAP::all_groups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类adLDAP
的用法示例。
在下文中一共展示了adLDAP::all_groups方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ADLDtest
function ADLDtest()
{
global $SAMSConf;
global $USERConf;
if ($USERConf->ToWebInterfaceAccess("C") != 1) {
exit;
}
$info = array();
$lang = "./lang/lang.{$SAMSConf->LANG}";
require $lang;
print "<H1>Test AD connection</H1>";
require_once "src/adldap.php";
//create the LDAP connection
$adldserver = GetAuthParameter("adld", "adldserver");
$basedn = GetAuthParameter("adld", "basedn");
$adadmin = GetAuthParameter("adld", "adadmin");
$adadminpasswd = GetAuthParameter("adld", "adadminpasswd");
$usergroup = GetAuthParameter("adld", "usergroup");
$LDAPBASEDN2 = strtok($basedn, ".");
$LDAPBASEDN = "DC={$LDAPBASEDN2}";
while (strlen($LDAPBASEDN2) > 0) {
$LDAPBASEDN2 = strtok(".");
if (strlen($LDAPBASEDN2) > 0) {
$LDAPBASEDN = "{$LDAPBASEDN},DC={$LDAPBASEDN2}";
}
}
$pdc = array("{$adldserver}");
$options = array(account_suffix => "@{$basedn}", base_dn => "{$LDAPBASEDN}", domain_controllers => $pdc, ad_username => "{$adadmin}", ad_password => "{$adadminpasswd}", "", "", "");
$ldap = new adLDAP($options);
$charset = explode(",", $_SERVER['HTTP_ACCEPT_CHARSET']);
$groups = $ldap->all_groups($include_desc = false, $search = "*", $sorted = true);
$gcount = count($groups);
print "<TABLE CLASS=samstable>";
print "<TH width=5%>No";
print "<TH >{$adldtest_1_authldaptray} {$basedn}";
for ($i = 0, $j = 1; $i < $gcount; $i++, $j++) {
$groupname = UTF8ToSAMSLang($groups[$i]);
echo "<TR><TD>{$j}:<TD>{$groupname} <BR>";
}
echo "</TABLE><P>";
$users = $ldap->all_users($include_desc = false, $search = "*", $sorted = true);
$count = count($users);
print "<TABLE CLASS=samstable>";
print "<TH width=5%>No";
print "<TH >{$adldtest_2_authldaptray} {$basedn}";
print "<TH > ";
$i = 0;
foreach ($users as $user) {
$i++;
$samaccountname = UTF8ToSAMSLang($user["samaccountname"]);
$displayname = UTF8ToSAMSLang($user["displayname"]);
echo "<TR><TD>{$i}: <TD> {$samaccountname} <TD> {$displayname}";
}
echo "</TABLE>";
}
示例2: TestPDC
function TestPDC()
{
global $SAMSConf;
$info = array();
$lang = "./lang/lang.{$SAMSConf->LANG}";
require $lang;
if (isset($_GET["auth"])) {
$auth = $_GET["auth"];
}
print "<H1>TEST PDC</H1>";
$value = ExecuteShellScript("getwbinfousers", "{$SAMSConf->WBINFOPATH}");
$a = explode(" ", $value);
sort($a);
$acount = count($a);
if ($auth == "ntlm") {
for ($i = 0; $i < $acount; $i++) {
print "{$a[$i]}<BR>\n";
}
}
if ($auth == "adld") {
require_once "adldap.php";
//create the LDAP connection
$pdc = array("{$SAMSConf->LDAPSERVER}");
$options = array(account_suffix => "@{$SAMSConf->LDAPDOMAIN}", base_dn => "{$SAMSConf->LDAPBASEDN}", domain_controllers => $pdc, ad_username => "{$SAMSConf->LDAPUSER}", ad_password => "{$SAMSConf->LDAPUSERPASSWD}", "", "", "");
$ldap = new adLDAP($options);
$groups = $ldap->all_groups($include_desc = false, $search = "*", $sorted = true);
$gcount = count($groups);
print "<TABLE CLASS=samstable>";
print "<TH width=5%>No";
print "<TH >{$SAMSConf->LDAPDOMAIN} groups";
for ($i = 0; $i < $gcount; $i++) {
echo "<TR><TD>{$i}:<TD>{$groups[$i]}<BR>";
}
echo "</TABLE><P>";
$users = $ldap->all_users($include_desc = false, $search = "*", $sorted = true);
$count = count($users);
print "<TABLE CLASS=samstable>";
print "<TH width=5%>No";
print "<TH >{$SAMSConf->LDAPDOMAIN} users";
for ($i = 0; $i < $count; $i++) {
$userinfo = $ldap->user_info($users[$i], $fields = NULL);
//$mcount=count($userinfo);
echo "<TR><TD>{$i}:<TD> {$users[$i]} ";
$aaa = $userinfo[0]["displayname"][0];
//$aaa2 = $userinfo[0]["givenname"][0];
//$aaa3 = $userinfo[0]["sn"][0];
echo "<TD>{$aaa} ";
}
echo "</TABLE>";
}
}
示例3: ImportFromADForm
function ImportFromADForm()
{
global $SAMSConf;
global $USERConf;
$lang = "./lang/lang.{$SAMSConf->LANG}";
require $lang;
if ($USERConf->ToWebInterfaceAccess("UC") != 1) {
exit(0);
}
PageTop("importfromad-48.jpg", " {$authadldbuttom_3_importfromad_ImportFromADForm_1} ");
require_once "src/adldap.php";
// print("<FORM NAME=\"AddDomainUsers\" ACTION=\"main.php\">\n");
$DB = new SAMSDB();
$adldserver = GetAuthParameter("adld", "adldserver");
$basedn = GetAuthParameter("adld", "basedn");
$adadmin = GetAuthParameter("adld", "adadmin");
$adadminpasswd = GetAuthParameter("adld", "adadminpasswd");
$usergroup = GetAuthParameter("adld", "usergroup");
$LDAPBASEDN2 = strtok($basedn, ".");
$LDAPBASEDN = "DC={$LDAPBASEDN2}";
while (strlen($LDAPBASEDN2) > 0) {
$LDAPBASEDN2 = strtok(".");
if (strlen($LDAPBASEDN2) > 0) {
$LDAPBASEDN = "{$LDAPBASEDN},DC={$LDAPBASEDN2}";
}
}
$pdc = array("{$adldserver}");
$options = array(account_suffix => "@{$basedn}", base_dn => "{$LDAPBASEDN}", domain_controllers => $pdc, ad_username => "{$adadmin}", ad_password => "{$adadminpasswd}", "", "", "");
$ldap = new adLDAP($options);
$groupinfo = $ldap->all_groups($include_desc = false, $search = "*", $sorted = true);
$gcount = count($groupinfo);
print "<FORM NAME=\"AddFromAD\" ACTION=\"main.php\">\n";
print "<INPUT TYPE=\"HIDDEN\" NAME=\"show\" id=Show value=\"exe\">\n";
print "<INPUT TYPE=\"HIDDEN\" NAME=\"function\" id=function value=\"importfromad\">\n";
print "<INPUT TYPE=\"HIDDEN\" NAME=\"filename\" id=filename value=\"authadldbuttom_3_importfromad.php\">\n";
/* */
echo "<TABLE WIDTH=90%>";
print "<TR><TD WIDTH=30%><B>{$authadldbuttom_3_importfromad_ImportFromADForm_2}:\n";
print "<TD WIDTH=70%><SELECT NAME=\"addgroupname[]\" SIZE=15 TABINDEX=30 MULTIPLE>\n";
asort($groupinfo);
foreach ($groupinfo as $group) {
$groupname = UTF8ToSAMSLang($group);
if (SearchAuthParameter("adld", "adldgroup", "{$groupname}") == 0) {
print "<OPTION VALUE=\"{$groupname}\"> {$groupname} \n";
}
}
print "</SELECT>\n";
print "<TR><TD>\n";
print "<B>{$usersbuttom_1_domain_AddUsersFromDomainForm_3} \n";
print "<TD>\n";
print "<SELECT NAME=\"groupname\" ID=\"groupname\" SIZE=1 TABINDEX=30 onchange=EnterNewGroupName(AddFromAD)>\n";
$num_rows = $DB->samsdb_query_value("SELECT * FROM sgroup");
while ($row2 = $DB->samsdb_fetch_array()) {
print "<OPTION VALUE=\"{$row2['s_group_id']}\"> {$row2['s_name']} ";
}
print "<OPTION VALUE=\"-2\"> {$usersbuttom_1_domain_AddUsersFromDomainForm_10}";
print "<OPTION VALUE=\"-1\"> {$usersbuttom_1_domain_AddUsersFromDomainForm_8} ";
print "</SELECT>\n";
print "<TR><TD ALIGN=RIGHT>\n";
print "{$usersbuttom_1_domain_AddUsersFromDomainForm_9}: \n";
print "<TD>\n";
print "<INPUT TYPE=\"TEXT\" NAME=\"newgroupname\" id=Newgroupname\" DISABLED>\n";
$DB->free_samsdb_query();
print "<TR><TD><B>{$usersbuttom_1_domain_AddUsersFromDomainForm_6}";
print "<TD><INPUT TYPE=\"CHECKBOX\" NAME=\"enabled\" CHECKED>";
print "<TR>\n";
print "<TD>\n";
print "{$shablonnew_NewShablonForm_3}:\n";
print "<TD>\n";
print "<INPUT TYPE=\"TEXT\" NAME=\"defaulttraf\" SIZE=6 VALUE=\"100\"> <B> 0 - unlimited traffic\n";
print "<TR>\n";
print "<TD>\n";
print "{$shablonnew_NewShablonForm_10}\n";
print "<TD>\n";
print "<SELECT NAME=\"period\" onchange=EnterPeriod(AddDomainUsers) {$CCLEAN}> \n";
print "<OPTION value=\"M\" SELECTED>{$shablonnew_NewShablonForm_11}\n";
print "<OPTION value=\"W\">{$shablonnew_NewShablonForm_12}\n";
print "<OPTION value=\"A\">{$shablonnew_NewShablonForm_13}\n";
print "</SELECT>\n";
print "<SCRIPT LANGUAGE=JAVASCRIPT> \n";
print "function EnterPeriod(formname) \n";
print "{ \n";
print " var period=formname.period.value; \n";
print " var clryear=formname.clryear.value; \n";
print " var clrmonth=formname.clrmonth.value; \n";
print " var clrday=formname.clrday.value; \n";
//print(" value=window.confirm(\"1? \" );\n");
print " if(period==\"A\") \n";
print " {\n";
print " formname.newperiod.disabled=false; \n";
print " formname.clryear.disabled=false; \n";
print " formname.clrmonth.disabled=false; \n";
print " formname.clrday.disabled=false; \n";
print " }\n";
print " else \n";
print " {\n";
print " formname.newperiod.disabled=true; \n";
print " formname.clryear.disabled=true; \n";
print " formname.clrmonth.disabled=true; \n";
print " formname.clrday.disabled=true; \n";
//.........这里部分代码省略.........
示例4: AddUsersFromADLDForm
function AddUsersFromADLDForm()
{
global $SAMSConf;
global $USERConf;
$lang = "./lang/lang.{$SAMSConf->LANG}";
require $lang;
if (isset($_GET["ldapgroup"])) {
$ldapgroup = $_GET["ldapgroup"];
}
if (isset($_GET["getgroup"])) {
$getgroup = $_GET["getgroup"];
}
if ($USERConf->ToWebInterfaceAccess("UC") != 1) {
exit(0);
}
PageTop("user.jpg", " {$usersbuttom_1_domain_AddUsersFromDomainForm_1} Active Directory ");
require_once "src/adldap.php";
print "<FORM NAME=\"AddDomainUsers\" ACTION=\"main.php\">\n";
$DB = new SAMSDB();
$adldserver = GetAuthParameter("adld", "adldserver");
$basedn = GetAuthParameter("adld", "basedn");
$adadmin = GetAuthParameter("adld", "adadmin");
$adadminpasswd = GetAuthParameter("adld", "adadminpasswd");
$usergroup = GetAuthParameter("adld", "usergroup");
$LDAPBASEDN2 = strtok($basedn, ".");
$LDAPBASEDN = "DC={$LDAPBASEDN2}";
while (strlen($LDAPBASEDN2) > 0) {
$LDAPBASEDN2 = strtok(".");
if (strlen($LDAPBASEDN2) > 0) {
$LDAPBASEDN = "{$LDAPBASEDN},DC={$LDAPBASEDN2}";
}
}
$pdc = array("{$adldserver}");
$options = array(account_suffix => "@{$basedn}", base_dn => "{$LDAPBASEDN}", domain_controllers => $pdc, ad_username => "{$adadmin}", ad_password => "{$adadminpasswd}", "", "", "");
$ldap = new adLDAP($options);
$usersgroupname = "Users";
$a = $ldap->all_users($include_desc = false, $search = "*", $sorted = true);
$acount = count($a);
if (strlen($ldapgroup) > 0 && $ldapgroup != "_allgroups_" && $ldapgroup != "_gettxtinput_") {
$usersgroupname = $ldapgroup;
} else {
if (strlen($ldapgroup) > 0 && $ldapgroup == "_gettxtinput_") {
$usersgroupname = $getgroup;
}
}
$groupinfo = $ldap->all_groups($include_desc = false, $search = "*", $sorted = true);
$gcount = count($groupinfo);
print "<FORM NAME=\"AddDomainUsers\" ACTION=\"main.php\">\n";
/* */
print "<SCRIPT language=JAVASCRIPT>\n";
print "function SelectADGroup(formname)\n";
print "{\n";
print " var group=formname.addgroupname.value; \n";
print " var getgroup=formname.getgroup.value; \n";
print " var str=\"main.php?show=exe&ldapgroup=\"+group+\"&getgroup=\"+getgroup+\"&function=addusersfromadldform&filename=authadldbuttom_2_usersadd.php\"; \n";
print " parent.basefrm.location.href=str;\n";
print "}\n";
print "function EnableTxtInput(formname)\n";
print "{\n";
print " value=document.forms[\"AddDomainUsers\"].elements[\"addgroupname\"].value;\n";
print " if(value==\"_gettxtinput_\") \n";
print " {\n";
print " document.forms[\"AddDomainUsers\"].elements[\"getgroup\"].disabled=false\n";
print " }\n";
print " else \n";
print " {\n";
print " document.forms[\"AddDomainUsers\"].elements[\"getgroup\"].disabled=true\n";
print " }\n";
print "}\n";
print "</SCRIPT> \n";
print "<TABLE WIDTH=90%>\n";
print "<TR><TD WIDTH=40%>{$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_1}</TD>\n";
print "<TD WIDTH=60%><SELECT NAME=\"addgroupname\" onChange=EnableTxtInput(AddDomainUsers)>\n";
print "<OPTION VALUE=\"_allgroups_\" SELECT onselect=EnableTxtInput(AddDomainUsers)> {$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_5}";
print "<OPTION VALUE=\"_gettxtinput_\" onselect=EnableTxtInput(AddDomainUsers)> {$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_6}";
foreach ($groupinfo as $group) {
$groupname = UTF8ToSAMSLang($group);
print "<OPTION VALUE=\"{$groupname}\" onselect=EnableTxtInput(AddDomainUsers)> {$groupname}";
}
/*
for($i=0;$i<$gcount;$i++)
{
$groupname = UTF8ToSAMSLang($groupinfo[$i]);
print("<OPTION VALUE=\"$groupname\" onselect=EnableTxtInput(AddDomainUsers)> $groupname");
}
*/
print "</SELECT>\n";
print "<TR><TD WIDTH=40%>{$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_7}\n";
print "<TD WIDTH=60%><INPUT TYPE=\"TEST\" NAME=\"getgroup\" SIZE=\"20\" DISABLED>\n";
print "</TABLE>\n";
print "<INPUT TYPE=\"BUTTON\" value=\"{$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_2}\" onclick=SelectADGroup(AddDomainUsers)>\n";
print "<P>\n";
/* */
if (strlen($ldapgroup) > 0 && $ldapgroup != "_allgroups_" && $ldapgroup != "_gettxtinput_") {
printf("<B>{$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_4}: <FONT COLOR=BLUE>{$ldapgroup}</FONT></B><BR>");
} else {
if (strlen($ldapgroup) > 0 && $ldapgroup == "_gettxtinput_") {
printf("<B>{$usersbuttom_1_adldap_AddUsersFromAdLDAPForm_4}: <FONT COLOR=BLUE>{$getgroup}</FONT></B><BR>");
} else {
print "<BR><B>{$usersbuttom_1_domain_AddUsersFromDomainForm_2}</B><BR>";
//.........这里部分代码省略.........