473,378 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Passing value from one script on one page to another script on another page.

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

%>

--


Jul 19 '05 #1
6 6097
If you only have one domain and all your users are in the same OU, you'd
just have to pass the username, like:

site.com/showuser.asp?user=username

But, if your users are stored in all different container or you have
different domains, you'd have to have to pass that info, to:
site.com/showuser.asp?dc=domain2&dc=com&ou=Accounting&usern ame=jsmith

With that, you could do:

<%
Dim sOU, sCN, sDC, aOU, aCN, aDC
Dim sUsername
sOU = Request.Querystring("ou") : aOU = Split(sOU, ", ")
sCN = Request.Querystring("cn") : aCN = Split(sCN, ", ") '''no container in
this example
sDC = Request.Querystring("dc") : aDC = Split(sDC, ", ")
sUsername = Request.Querystring("username")

sLDAP = "LDAP://"
For iCounter = 0 To UBound(aOU)
sLDAP = sLDAP & "ou=" & aOU(iCounter) & ","
Next

For iCounter = 0 To UBound(aCN)
sLDAP = sLDAP & "cn=" & aCN(iCounter) & ","
Next
For iCounter = 0 To UBound(aDC)
sLDAP = sLDAP & "dc=" & aDC(iCounter) & ","
Next

sLdap = Left(sLDAP, Len(sLDAP) - 1)

Then, do:

Set oContainer = GetObject(sLDAP)
'''code, code, code
If oUser.sAMAccountName= sUsername Then...
'''I'm sure there's a much more graceful way to build the ldap string out of
a querystring than what I demonstrated...

Ray at home
"Robert Cohen" <je*********@gratefuldead.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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

Jul 19 '05 #2
Okay, I have my first page with the output of for example:

http://www.bbhtx.org/Information2.asp?logonUser=dallen

or

http://www.bbhtx.org/Information2.asp?logonUser=rcohen

The question that I am having a hard time is using that value in the new
page. For example if I do

Passed Value= <% =logonuser %>

my output is:

Passed Value=

I would have fiqured it would be Passed Value=dallen or Passed Value= rcohen
with the respective code.

What am I doing wrong?

--
Sorry, I am no longer including my e-mail address as I am getting to much
spam. I really have no desire to enlarge "it" by three inches, that is even
if I get e-mailed 10 times a day from different e-mail addresses so I can't
block it.
Besides I finally came to believe what others have said, if you have a
question, you should ask the group as others might benefit from it. Anyone
on the group who I converse with off topic or on the side, can easily find
my e-mail address.
"Ray at <%=sLocation%>" <ra*@ajf8jalskdfna.sefrhja7yasdf.com> wrote in
message news:#c*************@TK2MSFTNGP11.phx.gbl...
If you only have one domain and all your users are in the same OU, you'd
just have to pass the username, like:

site.com/showuser.asp?user=username

But, if your users are stored in all different container or you have
different domains, you'd have to have to pass that info, to:
site.com/showuser.asp?dc=domain2&dc=com&ou=Accounting&usern ame=jsmith

With that, you could do:

<%
Dim sOU, sCN, sDC, aOU, aCN, aDC
Dim sUsername
sOU = Request.Querystring("ou") : aOU = Split(sOU, ", ")
sCN = Request.Querystring("cn") : aCN = Split(sCN, ", ") '''no container in this example
sDC = Request.Querystring("dc") : aDC = Split(sDC, ", ")
sUsername = Request.Querystring("username")

sLDAP = "LDAP://"
For iCounter = 0 To UBound(aOU)
sLDAP = sLDAP & "ou=" & aOU(iCounter) & ","
Next

For iCounter = 0 To UBound(aCN)
sLDAP = sLDAP & "cn=" & aCN(iCounter) & ","
Next
For iCounter = 0 To UBound(aDC)
sLDAP = sLDAP & "dc=" & aDC(iCounter) & ","
Next

sLdap = Left(sLDAP, Len(sLDAP) - 1)

Then, do:

Set oContainer = GetObject(sLDAP)
'''code, code, code
If oUser.sAMAccountName= sUsername Then...
'''I'm sure there's a much more graceful way to build the ldap string out of a querystring than what I demonstrated...

Ray at home
"Robert Cohen" <je*********@gratefuldead.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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


Jul 19 '05 #3
Your need...

LogonUser = Request.QueryString("logonUser")

That will set the value of LogonUser equal to the URL String Variable
logonUser

-Andrew

* * * Sent via DevBuilder http://www.devbuilder.org * * *
Developer Resources for High End Developers.
Jul 19 '05 #4
worked like a charm, thank you.

--
Sorry, I am no longer including my e-mail address as I am getting to much
spam. I really have no desire to enlarge "it" by three inches, that is even
if I get e-mailed 10 times a day from different e-mail addresses so I can't
block it.
Besides I finally came to believe what others have said, if you have a
question, you should ask the group as others might benefit from it. Anyone
on the group who I converse with off topic or on the side, can easily find
my e-mail address.
"Andrew Durstewitz" <ad******@devbuilder.org> wrote in message
news:3f*********************@news.frii.net...
Your need...

LogonUser = Request.QueryString("logonUser")

That will set the value of LogonUser equal to the URL String Variable
logonUser

-Andrew

* * * Sent via DevBuilder http://www.devbuilder.org * * *
Developer Resources for High End Developers.

Jul 19 '05 #5
Are you sure those aren't ex-girlfriends emailing you? ;o)

Sorry, couldn't resist.

-Andrew

* * * Sent via DevBuilder http://www.devbuilder.org * * *
Developer Resources for High End Developers.
Jul 19 '05 #6
:-)

--
Sorry, I am no longer including my e-mail address as I am getting to much
spam. I really have no desire to enlarge "it" by three inches, that is even
if I get e-mailed 10 times a day from different e-mail addresses so I can't
block it.
Besides I finally came to believe what others have said, if you have a
question, you should ask the group as others might benefit from it. Anyone
on the group who I converse with off topic or on the side, can easily find
my e-mail address.
"Andrew Durstewitz" <ad******@devbuilder.org> wrote in message
news:3f*********************@news.frii.net...
Are you sure those aren't ex-girlfriends emailing you? ;o)

Sorry, couldn't resist.

-Andrew

* * * Sent via DevBuilder http://www.devbuilder.org * * *
Developer Resources for High End Developers.

Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Xerxes | last post by:
Hi, how can I pass the returned value from Javascript to PHP? I have: ------------------------------------------------------------------------ ------ if ( x>y) {
4
by: Jason Us | last post by:
Does anyone have experience with passing variables from an ASP page to a JSP page. The way it currently works in passing the SSN in the URL. This cannot be good. I thought that storing a...
12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
2
by: Richard | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** HI, I am working on a project where I need to input data to a (local) HTML page using multiple form elements, such as text,...
7
by: Dave A | last post by:
I have two events in a form that I am passing. One is to a javascript function, the other is to the same .asp page only with another action to show different data. Onchange is calls the...
10
by: Noozer | last post by:
Below is some ASP, HTML and javascript. It is part of a page used to maintain a small database. This code did work at one time, but has since stopped. For some reason the data on my form is not...
5
by: Paul | last post by:
Just wondering if someone could provide an example of passing a variable from the code behind to javascript in vb. I want to have one control have focus with the page loading with one condition...
1
by: williamroy | last post by:
Hello, I've got a form that runs over 5 pages. I need the last page submit button to post all of the answers at one time from the previous 5 pages (to another server). I'd like to see the last...
1
by: | last post by:
Hi, 1st, I did a search and could not find any info on this, the Google results were good, but I'm still have issues...So any help will be great. I have a frame page, which contains 3 frames...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.