To ZCOLTON or anyone who can help
Hi,
I Have been trying to develope a web interface for active directory using classic ASP and LDAP.
Currently I have a page which displays all of the relevent SECURITY GROUPS in AD. Each group is actually a HREF which when clicked on displays a list of all users within the selected SECURITY GROUP.
The issues I would like to resolve are as follows:
1)Currently when a security group is selected a list of users belonging to that group is displayed, however the list of users is not displayed in a table. What I would like to do is to have the users belonging to that group displayed in a table next to the table containing the groups, I would also like each user to be a HREF link.
2)My second problem is I would like to create a page that works exactly the same way as my SECURITY GROUPS page (sg.asp) but for displaying DISTRIBUTION LISTS in AD.
I have included my code below for the SECURITY GROUPS page sg.asp aswell as the code for the header.asp include file:
sg.asp:
header.asp:
Any help with these issues would be greatly appreciated.
Thanks in advance,
Mo
Hi,
I Have been trying to develope a web interface for active directory using classic ASP and LDAP.
Currently I have a page which displays all of the relevent SECURITY GROUPS in AD. Each group is actually a HREF which when clicked on displays a list of all users within the selected SECURITY GROUP.
The issues I would like to resolve are as follows:
1)Currently when a security group is selected a list of users belonging to that group is displayed, however the list of users is not displayed in a table. What I would like to do is to have the users belonging to that group displayed in a table next to the table containing the groups, I would also like each user to be a HREF link.
2)My second problem is I would like to create a page that works exactly the same way as my SECURITY GROUPS page (sg.asp) but for displaying DISTRIBUTION LISTS in AD.
I have included my code below for the SECURITY GROUPS page sg.asp aswell as the code for the header.asp include file:
sg.asp:
Code:
<html>
<head>
<!--#include file="header.asp" -->
<script language=JScript runat=server>
function SortVBArray(arrVBArray) {
return arrVBArray.toArray().sort().join('\b');
}
</script>
</head>
<body>
<%
groupDSN=request.querystring("group")
groupCN=request.querystring("cn")
Const ADS_GROUP_TYPE_GLOBAL_GROUP = &h00000002
Const ADS_GROUP_TYPE_SECURITY_ENABLED = &h80000000
sGroupScope = ADS_GROUP_TYPE_GLOBAL_GROUP or ADS_GROUP_TYPE_SECURITY_ENABLED
Com.CommandText = "Select cn, adspath from 'GC://"+objADsPath+"' Where objectclass='group' AND GroupType='" & sGroupScope & "'"
Set rs = Com.Execute
response.Write "<table name=groups cellspacing=0 cellpadding=7 bordercolor=BLACK border=1 align=left>"
response.write "<td valign=top align=center><b>All Available Groups:</b></td>"
response.write "<tr></tr>"
do while not rs.EOF
response.write "<td><a href='sg.asp?group="&rs("adspath")&"&cn="&rs("cn")&" '> " & rs("cn") & "</a></td><tr>"
rs.movenext
loop
response.Write "</table>"
if groupDSN > "" then
set objgroup=GetObject(groupDSN)
response.write "<b>Members Of "+groupCN+"</b><br>"
tempstr=""
For each objMember in objGroup.Members
if tempstr<>"" then
tempstr=tempstr&"#"
end if
tempstr=tempstr&objMember.CN
next
Set objGroup=nothing
temparray=split(tempstr,"#")
SortArray = Split(SortVBArray(temparray), Chr(8))
For iLoop = LBound(SortArray) to UBound(SortArray)
response.write +SortArray(iLoop)+"<br>"
next
end if
rs.close
set rs=nothing
con.close
set con=nothing
%>
</body
</html>
header.asp:
Code:
<%
Dim strUsername,strUser,strEmail,con,rs,rsg,Com,objADsPath,objDomain
strUsername = Request.ServerVariables("auth_user")
strUsername = Right(strUserName, Len(strUserName) - InStrRev(strUserName, "\"))
Set objDomain = GetObject ("GC://rootDSE")
objADsPath = objDomain.Get("defaultNamingContext")
Set objDomain = Nothing
Set con = Server.CreateObject("ADODB.Connection")
con.provider ="ADsDSOObject"
con.open "Active Directory Provider"
Set Com = CreateObject("ADODB.Command")
Set Com.ActiveConnection = con
Com.CommandText ="select name,mail FROM 'GC://"+objADsPath+"' where sAMAccountname='"+strUsername+"'"
Set rs = Com.Execute
strUser=rs("name")
strEmail=rs("mail")
Set rs = Nothing
%>
<html>
<head>
</head>
<body>
<table cellspacing="0" cellpadding="40" bordercolor="BLUE" border="0" align="center">
<td><span class="b_FieldText_B"><b>User:</b></span> <%=strUser%></td>
<td><span class="b_FieldText_B"><b>E-mail:</b></span> <%=strEmail%></td>
<td><span class="b_FieldText_B"><b>Date:</b></span> <%= day(Date()) &"/"& month(Date()) &"/"& year(Date())%></td>
<td><span class="b_FieldText_B"><b>Logon Time:</b></span> <%=response.write(Time)%></td>
<tr></tr>
<table border="0" cellspacing="0" cellpadding="50" align="center">
<tr>
<td height="51">
<div align="center">
<input type="submit" name="Submit" value=" Security Groups " onClick="window.location='/AD/sg.asp'">
<input type="submit" name="Submit2" value=" E-mail Distribution Lists "onClick="window.location='/AD/dg.asp'">
<input type="submit" name="Submit3" value=" Add/Remove/Edit Users "onClick="window.location='/AD/user.asp'">
</div>
</td>
</tr>
</table>
</table>
</body>
</html>
Any help with these issues would be greatly appreciated.
Thanks in advance,
Mo