Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

user authentication does not work !!

Status
Not open for further replies.

meltingpot

Technical User
May 11, 2004
118
0
0
GB
Hi ... firstly ive searched through the previous issues of a similar nature with no luck ...

Im using DW 8, MS Access running on WIN2003 R2 and IIS6.

Ive simly used the built-in server behaviour and tp log in user, it just doesnt work. Im getting the user levels from the access database which has 2 levels, Administraor and User. Ive turned off most of the security restrictions in IE, and also my local firewall. Im running it on our internal Intranet so no real security issues.

Can anybody help, it should be simple BUT not for me !!
Any ideas ??
 
user authentication as in machine account to database or your own "login code"? ASP or PHP?

:-------------------------------------:
Do the DW »|MostarNetworks|
 
Hi .Im using ASP. Authentication is via a table in Access running on our Intranet server (W2003-R2). Ive simply used the server behaviour bulit into - WHOOPS IM ACTUALLY USING DW CS3 !!!!

It just jumps me straight back to the 'tryagain.asp' when I use the correct username and password.

Its got to me as there is nothing on the login.asp page and the succeeful login page that one should be directed too.
Heres the DW code...

===================================
THE LOGIN PAGE
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/jsastc.asp" -->
<%
' *** 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 = "userlevel"
MM_redirectLoginSuccess = "hello.asp"
MM_redirectLoginFailed = "tryagain.asp"

MM_loginSQL = "SELECT username, password"
If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
MM_loginSQL = MM_loginSQL & " FROM projectofficer WHERE username = ? AND password = ?"
Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
MM_rsUser_cmd.ActiveConnection = MM_jsastc_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 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
%>

Thanks for your efforts :)
 
Hi meltingpot,
it has been a while since I looked at the MM_asp but consider hand coding it and using cleaner code to troubleshoot. (unless some one jumps in on thread).
Not sure if this is the problem but it looks odd:
Code:
FROM projectofficer WHERE username = ? AND password = ?
?-should be your variables from forms.

Check out:
hope it helps.

:-------------------------------------:
Do the DW »|MostarNetworks|
 
lebisol
It looks as though the query code is OK - the next few lines look to be setting up a prepared statement and then supplying the parameters for it.
meltingpot Try a few appropriately place Response.Write statements and rem out the Response.Redirect so that you can see the actual variable values in the last series of If statements. That should take you direct to the problem.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
thanks for the help john [thumbsup2] I don't stay as sharp with server side code as I used to, my next suggestion was going to be either print/echo/responsewrite the session variables...perhaps they were never destroyed with all the testing/logins.

:-------------------------------------:
Do the DW »|MostarNetworks|
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top