HighDots Forums  

login to dynamic page using login ID as query building ID?

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss login to dynamic page using login ID as query building ID? in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
_Adrian
 
Posts: n/a

Default login to dynamic page using login ID as query building ID? - 07-11-2004 , 03:38 PM






Hey all.. I need to find a tutorial fast... I have a login page using the
DW MX user authentication functions, which works fine. The login
verification then refers to a page that I want to use as a Details page that
will dynamically populate content using that user ID entered into the login
page.

I'm told to somehow reference this login ID to a session ID, and then build
my recordset from that session ID, but I'm clueless! I've got to show this
to the client ASAP, so any help is appreciated...



Reply With Quote
  #2  
Old   
MindCrafter
 
Posts: n/a

Default Re: login to dynamic page using login ID as query - 07-11-2004 , 05:58 PM






_Adrian,
You can set a global variable by modifying the global.asa and then binding
the table's primary key or any unique field that identifies the user to the
nes variable in the bglobal.asa.

Sub Session_OnStart
' creates an empty variable when the website is opened in a browser
Session("UserId") = ""
End Sub
Sub Session_OnStart
' clears the session when session ends
Session("UserId") = Nothing
End Sub

Now modify your MM code in the logon page:

Add the uniqie identifyer to the select query
MM_rsUser.Source = "SELECT User_ID, UID, PWD"

Then bind the returned value tot he new global variable

If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("UserId") = MM_rsUser(0)

You can now reference the new session variable in you form's udate query.

sql=" UPDATE UserTable Set FirstName = " & request.form("txtFirstName") " & _
"WHERE User_ID = " & Session("UserId")


That all it takes

MindCrafter
[l=www.MindCrafter.com]http://www.mindcrafter.com


Reply With Quote
  #3  
Old   
_Adrian
 
Posts: n/a

Default Re: login to dynamic page using login ID as query - 07-12-2004 , 03:16 PM



Boy I must be dense... So how does this piece of code modify the global.asa?
and where do I put it on the login page specifically?

Also, you mentioned an update query, but I'm just trying to build a
recordset from that session variable....?



Reply With Quote
  #4  
Old   
Les Matthews
 
Posts: n/a

Default Re: login to dynamic page using login ID as query building ID? - 07-12-2004 , 04:01 PM



"_Adrian" <test (AT) test (DOT) com> wrote

Quote:
Hey all.. I need to find a tutorial fast... I have a login page using the
DW MX user authentication functions, which works fine. The login
verification then refers to a page that I want to use as a Details page
that
will dynamically populate content using that user ID entered into the
login
page.

I'm told to somehow reference this login ID to a session ID, and then
build
my recordset from that session ID, but I'm clueless! I've got to show this
to the client ASAP, so any help is appreciated...
You didn't say what server model you are using. Below is ASP. I'm not sure
that MM_Username is the name of the session (I think it is, but I don't have
DW with me right now so I can't check - you should be able to verify by
looking at the code on your login page).

SELECT * from myTable
WHERE userID = Session("MM_Username")




Reply With Quote
  #5  
Old   
_Adrian
 
Posts: n/a

Default Re: login to dynamic page using login ID as query building ID? - 07-12-2004 , 04:47 PM



Sorry about that Les, I thought I did... yes its ASP/VBscript.. I'll take a
look at building my query from that! THanks-



Reply With Quote
  #6  
Old   
_Adrian
 
Posts: n/a

Default Re: login to dynamic page using login ID as query building ID? - 07-12-2004 , 04:50 PM



Hmm.. I get an Access error in DW when trying to open the recordset:

Undefined function 'Session' in expression

Hmmm..



Reply With Quote
  #7  
Old   
MindCrafter
 
Posts: n/a

Default Re: login to dynamic page using login ID as query - 07-13-2004 , 01:43 PM



_Adrian,
Sorry for the delayed response.
RE: So how does this piece of code modify the global.asa?

The global.asa allows you to create "global" variables that are avaliable
through out the website or the specific directory that has
an application assigned to it. These session variables and even cookies are
created when any ASP web page is open in the website.

The code " Session("UserId") = MM_rsUser(0) will assign the first field in
the returned recordset to the "global" variable.

RE: Hmm.. I get an Access error in DW when trying to open the recordset:

Undefined function 'Session' in expression

The most likely cause it that the website does not have an "Application"
enabled.

Take a look in the Internet Information Service console.
Select the website you are editing.
Got to Properties | Home Directory
If the "Application " field is empty or "none" Click the "Create" button.
You should see "Default Application" appear in the field.
Then "OK" to save the changes




Reply With Quote
  #8  
Old   
_Adrian
 
Posts: n/a

Default Re: login to dynamic page using login ID as query - 07-14-2004 , 07:04 PM



Thanks.. I'll take a look at the IIS settings.. now its easy enough to build
the query in DW so that it selects the query against a Session ID, but what
I apparently am lacking is the know how to assign the session ID to the
value to be queued... I thought I knew how to do it, but subsequent testing
is failing me!! Do I assign the value to the SessionID from within the login
form? Before? AFter? I'm trying to assign the login ID value from that field
in the form to the Session ID. Make sense?>



Reply With Quote
  #9  
Old   
Paul Whitham TMM
 
Posts: n/a

Default Re: login to dynamic page using login ID as query - 07-14-2004 , 11:37 PM



If you are using the standard MM login behaviour then it creates a session
variable called MM_username. What is actually holds depends upon what you
told it would be the key value. You can then use this session variable on
subsequent pages

--
Regards

Paul Whitham
Macromedia Certified Professional for Dreamweaver MX2004
Valleybiz Internet Design
www.valleybiz.net

Team Macromedia Volunteer for Ultradev/Dreamweaver MX
www.macromedia.com/support/forums/team_macromedia

"_Adrian" <test (AT) test (DOT) com> wrote

Quote:
Thanks.. I'll take a look at the IIS settings.. now its easy enough to
build
the query in DW so that it selects the query against a Session ID, but
what
I apparently am lacking is the know how to assign the session ID to the
value to be queued... I thought I knew how to do it, but subsequent
testing
is failing me!! Do I assign the value to the SessionID from within the
login
form? Before? AFter? I'm trying to assign the login ID value from that
field
in the form to the Session ID. Make sense?





Reply With Quote
  #10  
Old   
_Adrian
 
Posts: n/a

Default Re: login to dynamic page using login ID as query - 07-15-2004 , 02:14 AM



Thanks Paul.. but how do I tell DW that I need to build the query against
MM_username?



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.