Merged Login Problem

Posted on 2009-05-14
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 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... ;-)
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 30

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 30

Accepted Solution

Wayne Barron earned 500 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 30

Expert Comment

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


Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

831 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