Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - I need help....newbie
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

I need help....newbie

 Post Reply Post Reply
Author
aspidiot2 View Drop Down
Newbie
Newbie
Avatar

Joined: 24 May 2004
Location: United States
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote aspidiot2 Quote  Post ReplyReply Direct Link To This Post Topic: I need help....newbie
    Posted: 24 May 2004 at 4:23pm

I am trying to do is to build a website for my Lodge. When a Lodge member logs in, I want to display the account information associated with the user name and password. I have created a login page and it seems to work. My problem is, when I login with any user name and password I can only display the first record in my database. Its porbably a simple fix, but I am new to this. I am using DreamWeaver MX and MS Access 2003. Am I missing a SQL statement or something? If so please tell what it is and on which page it belongs. Please help fix my site.

Here is the code for the login page:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/registration.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_registration_STRING
Recordset1.Source = "SELECT * FROM registration"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString
MM_valUsername=CStr(Request.Form("UserName"))
If MM_valUsername <> "" Then
  MM_fldUserAuthorization="AccessPriviledge"
  MM_redirectLoginSuccess="restricted/results.asp"
  MM_redirectLoginFailed="www/Master-Mason.htm"
  MM_flag="ADODB.Recordset"
  set MM_rsUser = Server.CreateObject(MM_flag)
  MM_rsUser.ActiveConnection = MM_registration_STRING
  MM_rsUser.Source = "SELECT UserName, UserPass"
  If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
  MM_rsUser.Source = MM_rsUser.Source & " FROM registration WHERE UserName='" & Replace(MM_valUsername,"'","''") &"' AND UserPass='" & Replace(Request.Form("UserPass"),"'","''") & "'"
  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
%>

Here is the code for my results page:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
' *** Logout the current user.
MM_Logout = CStr(Request.ServerVariables("URL")) & "?MM_Logoutnow=1"
If (CStr(Request("MM_Logoutnow")) = "1") Then
  Session.Contents.Remove("MM_Username")
  Session.Contents.Remove("MM_UserAuthorization")
  MM_logoutRedirectPage = "../Master-Mason.htm"
  ' redirect with URL parameters (remove the "MM_Logoutnow" query param).
  if (MM_logoutRedirectPage = "") Then MM_logoutRedirectPage = CStr(Request.ServerVariables("URL"))
  If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
    MM_newQS = "?"
    For Each Item In Request.QueryString
      If (Item <> "MM_Logoutnow") Then
        If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS & "&"
        MM_newQS = MM_newQS & Item & "=" & Server.URLencode(Request.QueryString(Item))
      End If
    Next
    if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage = MM_logoutRedirectPage & MM_newQS
  End If
  Response.Redirect(MM_logoutRedirectPage)
End If
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="member"
MM_authFailedURL="../Master-Mason.htm"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (false 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
%>
<!--#include file="../../Connections/registration.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_registration_STRING
Recordset1.Source = "SELECT * FROM registration"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Recordset2__MMColParam
Recordset2__MMColParam = "1"
If (Request.QueryString("ID") <> "") Then
  Recordset2__MMColParam = Request.QueryString("ID")
End If
%>
<%
Dim Recordset2
Dim Recordset2_numRows

Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_registration_STRING
Recordset2.Source = "SELECT * FROM registration WHERE ID = " + Replace(Recordset2__MMColParam, "'", "''") + ""
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 1
Recordset2.Open()

Recordset2_numRows = 0
%>
<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
  MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_k

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 24 May 2004 at 5:11pm
sorry, but drop the dreamweaver code and write the code yourself.

you can start with the tutorials and sample applications on this site and ask for help here if you are stuck and we will help you the best we can. just don't come with generated code like this! PLEASE!


Welcome to the forums BTW
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 24 May 2004 at 6:08pm
Hmmmm very complicated code, that could be simplified a lot.  Make sure you got all your WHERES in.  If you want to display multiple records make sure you do a recordset loop (EG DO UNTIL recordSET.EOF)
Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 2004 at 1:37pm
hmm... i don't know which is worse... the fact that you are using dreamweaver code, or the fact that you had to register as "aspidiot2" because there was already an "aspidiot" registered...
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 27 May 2004 at 11:14pm
LOL
Back to Top
MurrayNeill View Drop Down
Newbie
Newbie


Joined: 05 July 2004
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote MurrayNeill Quote  Post ReplyReply Direct Link To This Post Posted: 05 July 2004 at 11:10pm

First of all I am surprised at the elitist attitude you have encountered here.  So your new to this and your using DW code... so what guys? we've all got to start somewhere.

It seems to me your problem is a fairly simple one that I remember encountering myself when I was learning. All you're missing is a parameter to tell your page what record to select. By default it will display the first record. You need to add a filter to select the record of the logged in user. To do this simply add a filter to your recordset that will select the record where the username field = the session variable MM_username.

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 06 July 2004 at 2:42pm
Generated code like that is not the place to start AT ALL!

The code looks like crap and it's almost unable to read and edit it. Much of it could also have been done better with half the code..

Also when generating code like that, you have no chances of learning something of it, as you can't read and understand sh*t of it when you are a newbie, and, if you are one of the few newbies who actually may understand it, you would just teach yourself bad code practices..
Back to Top
MurrayNeill View Drop Down
Newbie
Newbie


Joined: 05 July 2004
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote MurrayNeill Quote  Post ReplyReply Direct Link To This Post Posted: 06 July 2004 at 4:34pm
I agree it is not the best code and probably not the best way to learn.  However the guy is obviously not a professional and just wants to get his site up and running. Hes not trying out for asp coder of the year.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.