Merged Login Problem

Posted on 2009-05-14
Medium Priority
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:
' *** 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)
If MM_valUsername <> "" Then
  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
  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)
      Session("MM_UserAuthorization") = ""
    End If
    if CStr(Request.QueryString("accessdenied")) <> "" And false Then
      MM_redirectLoginSuccess = Request.QueryString("accessdenied")
    End If
  End If
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:

' *** Restrict Access To Page: Grant or deny access to this page
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)
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...
Question by:CSharpGuru
  • 3
  • 3
  • 2
LVL 10

Expert Comment

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!

Author Comment

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.
LVL 10

Expert Comment

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:


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... ;-)
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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

Author Comment

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

Accepted Solution

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

Username = logincookie
password = 12345678

Let me know if you have any questions.

Author Closing Comment

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.
LVL 31

Expert Comment

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


Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

624 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