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... ;-)
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help me. 3 56
Robocopy: Copy files from old server to new one, without overwriting any files at the destination? 2 45
Attention Please 10 43
powershell script 9 26
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

821 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