Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Multiple logins on one page?

LEGEND ,
Oct 22, 2008 Oct 22, 2008

Copy link to clipboard

Copied

I have a need to put two logins on one page but of course the default
user authorization doesn't allow this.

The first login goes to one page and the 2nd goes to another.

Any ideas?
TOPICS
Server side applications

Views

1.4K
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 22, 2008 Oct 22, 2008

Copy link to clipboard

Copied

Art wrote:
> I have a need to put two logins on one page but of course the default
> user authorization doesn't allow this.
>
> The first login goes to one page and the 2nd goes to another.
>
> Any ideas?

I'm thinking an if statement around the script portion of the site would
do it but I'm not sure how it would know which button was pressed

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 22, 2008 Oct 22, 2008

Copy link to clipboard

Copied

why would you need to put 2 logins on one page. what cant you just give
users a level, thus on logging in one level of user would be redir one place
and another level of user would be redir to another.

you never mentioned your page type



Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 22, 2008 Oct 22, 2008

Copy link to clipboard

Copied

Below is the standard script that is used in Dreamweaver ASP

I was thinking of Dim-ing a value for each button:
Dim MM_buttonOne
Dim MM_buttonTwo

And then

Dim MM_buttonOne = Something here but I don't know what it would be.
Dim MM_buttonOne = Something here but I don't know what it would be.

Once I know how to register which button has been pressed, I can then
put an if statement in to say:

If MM_buttonOne <> "" then...do something

Else If MM_buttonOne <> "" then do something else.

So, I guess my first hurdle is to figure out how to capture the button
pressed

That is, of course, there isn't an easier solution.

---------------------------------------

<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction + "?"
+ Server.HTMLEncode(Request.QueryString)
MM_valUsername = CStr(Request.Form("username"))
If MM_valUsername <> "" Then
Dim MM_fldUserAuthorization
Dim MM_redirectLoginSuccess
Dim MM_redirectLoginFailed
Dim MM_loginSQL
Dim MM_rsUser
Dim MM_rsUser_cmd

MM_fldUserAuthorization = ""
MM_redirectLoginSuccess = "mapdealer.asp"
MM_redirectLoginFailed = "sorry.asp"

MM_loginSQL = "SELECT username, password"
If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & ","
& MM_fldUserAuthorization
MM_loginSQL = MM_loginSQL & " FROM dbo.atblPDLogin WHERE username = ?
AND password = ?"
Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
MM_rsUser_cmd.ActiveConnection = MM_connShnta_STRING
MM_rsUser_cmd.CommandText = MM_loginSQL
MM_rsUser_cmd.Parameters.Append
MM_rsUser_cmd.CreateParameter("param1", 200, 1, 50, MM_valUsername) '
adVarChar
MM_rsUser_cmd.Parameters.Append
MM_rsUser_cmd.CreateParameter("param2", 200, 1, 50,
Request.Form("password")) ' adVarChar
MM_rsUser_cmd.Prepared = true
Set MM_rsUser = MM_rsUser_cmd.Execute

If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") =
CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And true Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 22, 2008 Oct 22, 2008

Copy link to clipboard

Copied

Twocans wrote:
> why would you need to put 2 logins on one page. what cant you just give
> users a level, thus on logging in one level of user would be redir one place
> and another level of user would be redir to another.
>
> you never mentioned your page type


Page type is ASP

OK, got it figured out...thanks Twocans, the"redirect" idea did the
trick. I just used the MM_UserAuthorization session that's generated by
Dreamweaver to determine which page they were intending to go to.

For anyone who cares, here's what I did...

On the login page, I did the standard "Access Level Login." In the
database, I had a level "8" for one and a different level "9" for the
other.

I then created a redirect.asp page and put this on it.

<%
If Session("MM_UserAuthorization") <> "" AND
Session("MM_UserAuthorization") = 8 Then
Response.Redirect("dealer1.asp")
End If
%>
<%
If Session("MM_UserAuthorization") <> "" AND
Session("MM_UserAuthorization") = 9 Then
Response.Redirect("dealer2.asp")
End If
%>

Don't forget to change the link on the "sorry" page so that it goes to
the redirect page to. In my case, I also had to add the "Access Level."
to the page.



Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 23, 2008 Oct 23, 2008

Copy link to clipboard

Copied

LATEST

I'm doing something similar. I have a dbase with multiple logins which are associated with a unique userID. When someone logs in with their username, the page should go to their unique userID. I've followed this article here - http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15881&sliceId=2#aspvb_user


Here's how my code looks:


<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" +
Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("Email"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="update.asp"
MM_redirectLoginFailed="login_fail.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_sContent_STRING

'added userID here
MM_rsUser.Source = "SELECT Email, pass, userID"

If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source &
"," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM MyTable WHERE Email='" &
Replace(MM_valUsername,"'","''") &"' AND pass='" &
Replace(Request.Form("pass"),"'","''") & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername

' added code
MM_redirectLoginSuccess = CStr(MM_rsUser.Fields.Item("userID").Value)


If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") =
CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And true Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>


but this code only redirects the page to the right userID but not the update.asp page. So it goes to www.mywebsite.com/394 rather than www.mywebsite.com/update.asp?userID=394 which is what I really need. I wonder would you guys have any idea about this? How do I add the update.asp?userID= to the redirect?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines