View Full Version : login to direct to a unique page
Joanne
06-03-2003, 02:04 PM
I'm using FP200 and trying to setup a login system where the user is directed to a page specific to them based on their user ID and password (i.e. logging in to see their own account info.) I have an Access DB with user IDs and passwords as well as the name of the page associated with each user, and I have the code to verify the password and user ID, but how do I redirect to the user's page?
Any help is greatly appreciated! :)
skriptkiddie
06-03-2003, 09:14 PM
Without seeing your sql statement and branching statement (if/then for ie) it's hard to say. But in your sql statement is it grabbing the webpage data? If so just do a response.redirect on that.
Post only the code that matters if you still need help.
Bullschmidt
06-03-2003, 10:12 PM
Here's some info on logins that I previously put together which might be of some help too.
Perhaps have a login page that asks the user for his username and password. And whatever page that posts to (which could be the same page for a self posting form) tests these fields against what is in the database, sets the username and userlevel session variables accordingly, and then redirects to the proper page - i.e. back to the login page if the password is wrong (perhaps with a JavaScript popup saying wrong username/password combination) or to the main menu page if the password is correct:
Session("UserName") = objRS("UserName")
Session("UserLevel") = objRS("UserLevel")
Response.Redirect "mainmenu.asp"
Then you can use If Then's or Select Case on each page to control whether a user is allowed to actually be there and whether particular links of where a user can go actually show up.
If (Session("UserLevel") <> "Admin") And (Session("UserLevel") <> "Regular") Then
Response.Redirect "login.asp"
End If
Joanne
06-04-2003, 07:56 AM
Originally posted by Bullschmidt
Response.Redirect "mainmenu.asp"
This is good if all users are trying to login to the same page, but I don't want it to redirect to the same page every time. I want it to redirect to "Bob's page" when Bob logs in and redirect to "Suzie's page" when Suzie logs in.
I have an Access DB with userIDs, passwords and the corresponding page name for each user. I just don't know how to make the redirect statement look to the DB for where it should go.
Thanks for the responses so far!
Bullschmidt
06-04-2003, 07:59 AM
Session("UserName") = objRS("UserName")
Session("UserLevel") = objRS("UserLevel")
Session("UserHomePage") = objRS("UserHomePage")
Response.Redirect Session("UserHomePage")
Joanne
06-04-2003, 08:01 AM
Ah you are wonderful :D
Bullschmidt
06-04-2003, 08:01 PM
Originally posted by Joanne
Ah you are wonderful :D
Many thanks for the compliment! :)
badguy
08-11-2003, 12:28 PM
I too have a database with logins and a specific url that I want users to be redirected to BUT, I am using the "LOGON_USER" function to get the user ID from the server.
How would I go about redirecting the user based on that?
Bullschmidt
08-11-2003, 05:35 PM
I'm not familier with the LOGON_USER() function but if you've got a custom function like that then perhaps you could do something like this:
Select Case LOGON_USER()
Case "Steve"
Response.Redirect "steve.asp"
Case "James"
Response.Redirect "james.asp
Else
Response.Redirect "default.asp"
End Select
webster252003
08-12-2003, 11:25 PM
@Bullschmidt - LOGON_USER is an HTTP HEADER not a fuction. You code contained an error!
Should more like this:
Select Case LOGON_USER()
Case "Steve"
Response.Redirect "steve.asp"
Case "James"
Response.Redirect "james.asp
Case Else
Response.Redirect "default.asp"
End Select
badguy
08-13-2003, 06:50 AM
Thanks for the help guys
Zecho
01-11-2004, 08:51 PM
Should be more like this:
Select Case LCase(LOGON_USER())
Case "steve"
Response.Redirect "steve.asp"
Case "james"
Response.Redirect "james.asp
Case Else
Response.Redirect "default.asp"
End Select
vBulletin v3.0.3, Copyright ©2000-2012, Jelsoft Enterprises Ltd.