Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Merged Login Problem

Posted on 2009-05-14
8
Medium Priority
?
366 Views
Last Modified: 2013-12-25
I'll give $20 to anyone who provides me an answer to this problem that fixes it.
Here is login.asp's login script part:
CODE
<%
' *** 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
  MM_fldUserAuthorization=""
  MM_redirectLoginSuccess="../welcome2.asp"
  MM_redirectLoginFailed="login.asp?valid=1"
  MM_flag="ADODB.Recordset"
  set MM_rsUser = Server.CreateObject(MM_flag)
  MM_rsUser.ActiveConnection = MM_connTest_STRING
  MM_rsUser.Source = "SELECT users_email, users_password"
  If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
  MM_rsUser.Source = MM_rsUser.Source & " FROM test.users WHERE users_email='" & Replace(MM_valUsername,"'","''") &"' AND users_password='" & Replace(Request.Form("password"),"'","''") & "'"
  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
    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 false 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
%>
This file used to be located in two directories, each leading to a different page (dir1/welcome.asp, dir2/welcome.asp)
Each of these welcome.asp files had the follow code at the top to choose whether or not the user was granted access:

CODE
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="..quote/login2.asp"
MM_grantAccess=true
If Session("MM_Username") <> "" Then
  If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%>


Why would dir1/welcome.asp work after I login but not dir2/welcome.asp. But yet if I login using the dir2/login.asp old script it lets me in...
0
Comment
Question by:CSharpGuru
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 24386190
i don't get what you're trying to do here... you have to logins that go to the same page? why? just have one login, and on the older login page, redirect to the new one!
0
 

Author Comment

by:CSharpGuru
ID: 24386296
Ok I should be more clear. The developers for some reason to my site, made two seperate login pages, tied to the same database. They both direct to 2 seperate pages. I just want to change it to one login, which in turn directs them to a new page that lets them go to either page logged in. Before the chain went like this:
home page->Option 1->Login->Option one welcome page
                  ->Option 2->Login->Option two welcome page
I want it to be this way:
home page->Login->Choose option page->option 1 or two welcome page

That way they don't have to login twice if they switch to the other page b/c once they leave the area it logs them out. Plus having two login pages is kind of redundant. I have all this in effect but for some reason the login scripts don't work for option two, it still acts like I'm not authenticated. I don't know why. But option 1 it does say I'm authenticated. I still have to use the second login page to authenticate myself for option 2. But...both login scripts are the same...so why would it matter.
0
 
LVL 10

Expert Comment

by:MaxOvrdrv2
ID: 24386351
super easy, to prevent old users from accessing the old login via the old/soon to be useless login page, simply change the code in the one that you have chosen to remove with this:

response.redirect("newloginpage.asp")

then, in the new login page, simply keep it working the way it was, or make some modifications if needed for the new way... once they are logged in, direct them to a page that you will create, which offers them the 2 options, and when they click on the option, they are sent to the right place...

let me know if that works for you... simple is best, don't try to merge 2 login pages into one... delete one, and use only the other one... ;-)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24387240
The old Dreamweaver Login Script.
I hated that script so bad it was unreal.
It did a 1/2 A** job, but was not the best thing in the world.

If you decide that you want to go a different route and dump that script
Let me know, I have a cookie demo that will work great for authenticating your users.

Good Luck
Carrzkiss
0
 

Author Comment

by:CSharpGuru
ID: 24412147
yes if you have another login script I'd be more then happy to take a look at it.
0
 
LVL 31

Accepted Solution

by:
Wayne Barron earned 2000 total points
ID: 24481443
sorry that I am repling so late.

http://ee.cffcs.com/Q_24252782/login.asp
code
http://ee.cffcs.com/Q_24252782/Q_24252782.zip
Username = logincookie
password = 12345678

Let me know if you have any questions.
Carrzkiss
0
 

Author Closing Comment

by:CSharpGuru
ID: 31581512
Sorry I didn't see this before, even though the problem changed slightly your other post already fixed both situations :) You're simply amazing.
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 24529993
you are welcome.
Keep on coding.
Have a good one.

Carrzkiss
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question