R
Robert Cohen
Hi All,
I have what is an easy question for you all, but I have not idea (this
is in vbscript). I have this script below that works great. It figures out
the user logged in and gives the AD information about the user.
On another webpage, I have a staff directory which lists all the users.
What I would like to do is create a link on the staff directory that will
open up this information page with the user specified (instead of the logged
in user) What I would like to know is how should the link be set up to pass
the value (the value of the oUser.sAMAccountName that is being clicked) and
to put it into the script below. I know how to set up a hyperlink but need
to know how it should read (is it like
www.bbhtx.org/information.asp?oUser.sAMAccountname="rcohen" or something
like that)? And how would I declare the value in the new page? Please
advise.
<%
d = Request.ServerVariables("REMOTE_USER")
p = Instr(d, "\")
logonUser = Right(d, Len(d) - p)
On Error Resume Next
Dim oContainer
Dim FileSystem
Set
oContainer=GetObject("LDAP://ou=Staff,DC=baltimorebehavioralhealth,DC=org")
EnumerateUsers oContainer
Set oContainer = Nothing
Sub EnumerateUsers(oCont)
Dim oUser
For Each oUser In oCont
Select Case LCase(oUser.Class)
Case "user"
If oUser.sAMAccountName= logonUser Then
Response.Write "<h2>" & oUser.FullName & "'s Basic Information" &
"</h2><TABLE BORDER=0> <TR><TH></TH><TH></TH></TR>"
Response.Write "<tr><td><b>First Name:</b></td><td></td><td>" &
oUser.givenName & ""
Response.Write "<tr><td><b>Last Name:</b></td><td></td><td>" & oUser.sn &
"</td></tr>"
Response.Write "<tr><td><b>Extension:</b></td><td></td><td>" &
oUser.TelephoneNumber & "</td></tr>"
Response.Write "<tr><td><b>Title:</b></td><td></td><td>" & oUser.Title &
"</td></tr>"
Response.Write "<tr><td><b>Department:</b></td><td></td><td>" &
oUser.Department & "</td></tr>"
Response.Write "<tr><td><b>Office:</b></td><td></td><td>" &
oUser.physicalDeliveryOfficeName & "</td></tr>"
Response.Write "<tr><td><b>Mobile Phone:</b></td><td></td><td>" &
oUser.Mobile & "</td></tr>"
strManager = oUser.Manager
If strManager <> "" Then
Set objManager = GetObject("LDAP://" & oUser.Manager)
strCN = objManager.displayname
strNTName = objManager.sAMAccountName
End If
Response.Write "<tr><td><b>Manager: </b></td><td></td><td>" & strCN &
"</td></tr>"
Response.Write "<tr><td><b>Directly Reports to " & oUser.givenName &
":</b></td><td></td><td></td></tr>"
strDirectReports = _
oUser.GetEx("directReports")
For Each strValue in strDirectReports
Set strDirect = GetObject("LDAP://" & strValue)
strCN = strDirect.displayname
Response.Write "<tr><td></td><td></td><td>" & strCN & "</td></tr>"
Next
LogonUser = oUser.sAMAccountName & ".jpg"
%></table><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
<p><img border="0" src="Pictures/Staff/<% =LogonUser %>" width="150"
height="200"></p>
<%
Response.Write "<h3>Additional Information For Administrative Purposes
Only</h3>"
%> <!--mstheme--></font><TABLE BORDER=0>
<TR><TH><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"></TH>
<TH><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"></TH>
</TR>
<%
Response.Write "<tr><td><b>profilePath:</td><td></b>" & oUser.ProfilePath &
"</td></tr>"
Response.Write "<tr><td><b>scriptPath:</td><td></b>" & oUser.ScriptPath &
"</td></tr>"
Response.Write "<tr><td><b>homeDirectory:</td><td></b>" &
oUser.HomeDirectory & "</td></tr>"
Response.Write "<tr><td><b>homeDrive:</td><td></b>" & oUser.HomeDrive &
"</td></tr>"
Response.Write "<tr><td><b>Account Created:</td><td></b>" &
oUser.whenCreated & "</td></tr>"
End If
Case "organizationalunit" , "container"
EnumerateUsers oUser
End Select
Next
End Sub
%>
--
I have what is an easy question for you all, but I have not idea (this
is in vbscript). I have this script below that works great. It figures out
the user logged in and gives the AD information about the user.
On another webpage, I have a staff directory which lists all the users.
What I would like to do is create a link on the staff directory that will
open up this information page with the user specified (instead of the logged
in user) What I would like to know is how should the link be set up to pass
the value (the value of the oUser.sAMAccountName that is being clicked) and
to put it into the script below. I know how to set up a hyperlink but need
to know how it should read (is it like
www.bbhtx.org/information.asp?oUser.sAMAccountname="rcohen" or something
like that)? And how would I declare the value in the new page? Please
advise.
<%
d = Request.ServerVariables("REMOTE_USER")
p = Instr(d, "\")
logonUser = Right(d, Len(d) - p)
On Error Resume Next
Dim oContainer
Dim FileSystem
Set
oContainer=GetObject("LDAP://ou=Staff,DC=baltimorebehavioralhealth,DC=org")
EnumerateUsers oContainer
Set oContainer = Nothing
Sub EnumerateUsers(oCont)
Dim oUser
For Each oUser In oCont
Select Case LCase(oUser.Class)
Case "user"
If oUser.sAMAccountName= logonUser Then
Response.Write "<h2>" & oUser.FullName & "'s Basic Information" &
"</h2><TABLE BORDER=0> <TR><TH></TH><TH></TH></TR>"
Response.Write "<tr><td><b>First Name:</b></td><td></td><td>" &
oUser.givenName & ""
Response.Write "<tr><td><b>Last Name:</b></td><td></td><td>" & oUser.sn &
"</td></tr>"
Response.Write "<tr><td><b>Extension:</b></td><td></td><td>" &
oUser.TelephoneNumber & "</td></tr>"
Response.Write "<tr><td><b>Title:</b></td><td></td><td>" & oUser.Title &
"</td></tr>"
Response.Write "<tr><td><b>Department:</b></td><td></td><td>" &
oUser.Department & "</td></tr>"
Response.Write "<tr><td><b>Office:</b></td><td></td><td>" &
oUser.physicalDeliveryOfficeName & "</td></tr>"
Response.Write "<tr><td><b>Mobile Phone:</b></td><td></td><td>" &
oUser.Mobile & "</td></tr>"
strManager = oUser.Manager
If strManager <> "" Then
Set objManager = GetObject("LDAP://" & oUser.Manager)
strCN = objManager.displayname
strNTName = objManager.sAMAccountName
End If
Response.Write "<tr><td><b>Manager: </b></td><td></td><td>" & strCN &
"</td></tr>"
Response.Write "<tr><td><b>Directly Reports to " & oUser.givenName &
":</b></td><td></td><td></td></tr>"
strDirectReports = _
oUser.GetEx("directReports")
For Each strValue in strDirectReports
Set strDirect = GetObject("LDAP://" & strValue)
strCN = strDirect.displayname
Response.Write "<tr><td></td><td></td><td>" & strCN & "</td></tr>"
Next
LogonUser = oUser.sAMAccountName & ".jpg"
%></table><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica">
<p><img border="0" src="Pictures/Staff/<% =LogonUser %>" width="150"
height="200"></p>
<%
Response.Write "<h3>Additional Information For Administrative Purposes
Only</h3>"
%> <!--mstheme--></font><TABLE BORDER=0>
<TR><TH><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"></TH>
<TH><!--mstheme--><font face="Trebuchet MS, Arial, Helvetica"></TH>
</TR>
<%
Response.Write "<tr><td><b>profilePath:</td><td></b>" & oUser.ProfilePath &
"</td></tr>"
Response.Write "<tr><td><b>scriptPath:</td><td></b>" & oUser.ScriptPath &
"</td></tr>"
Response.Write "<tr><td><b>homeDirectory:</td><td></b>" &
oUser.HomeDirectory & "</td></tr>"
Response.Write "<tr><td><b>homeDrive:</td><td></b>" & oUser.HomeDrive &
"</td></tr>"
Response.Write "<tr><td><b>Account Created:</td><td></b>" &
oUser.whenCreated & "</td></tr>"
End If
Case "organizationalunit" , "container"
EnumerateUsers oUser
End Select
Next
End Sub
%>
--