Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 4th, 2003, 04:14 PM
Authorized User
 
Join Date: Jul 2003
Location: Houston, Texas, USA.
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nvillare
Default Please Help! Attempt to create a login page

I am attempting to creata a login page. I am having difficulty. Also the connection for the database I got from a site. Please advice!!

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'checks for absence of the sign in button
if isempty(Request.Form("LogIn")) then
 'if absent then it is the first attepmt
 Session("NumAttempts") = 1
  'variable is created
  TheMessage = "Please Login:"
  else

default_DB_Path = Request.ServerVariables("APPL_PHYSICAL_PATH") & "geo.mdb"
geo = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & default_DB_Path & ";"
Set default_DB_conn = Server.CreateObject("ADODB.Connection")
default_Db_conn.Open geo

  mySQL = "SELECT ID, userName, email FROM LogIn WHERE " _
  & "email = '" & Request.Form("email") & "' and " _
  & "passwordd = '" & Request.Form("password") & "'")
  if RSLogin.EOF then
   Session("NumAttepmts") = Session("NumAttempts") + 1
   if Application("NumAttempts") = 0 then
     TheMessage = "Login not found, pleae try again:"
    'compares number of login attempts to number allowed
    elseif Session("NumAttempts") > Application("NumAttempts") then
      TheMessage = "Login not found. No more attempts allowed."
      else
      TheMessage = "Login not found, please try again:"
      end if
    else
    'session variables are created to store information about the visitor
      Session("ID") = RSLogin("ID")
      Session("userName") = RSLogin("userName")
      Response.Redirect "index.asp"

'to call the username during the session
'<%= session("userName")%>

<html>
<head>
<title>LogIn Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript">
window.defaultStatus = "Welcome, Please Login";
</script>
</head>

<body>
<p><center><% Response.Write TheMessage %></center></p>
<%
if TheMessage <> "Login not found. No more attempts allowed." then
%>

<form action="edit.asp" method="post">
<p><table width="40%" align="center" border="0" cellpadding="5" cellspacing="10">
<tr>
  <td width="40%">User Name:</td>
  <td><input type="text" name="userName" value="" size="30" maxlength="25"></td>
</tr>
<tr>
  <td>Password:</td>
  <td><input type="text" name="password" value="" size="30" maxlength="25"></td>
</tr>
<tr>
  <td colspan="2"><center><input type="submit" name="LogIn" value="LogIn" ></center></td>
</tr>
<tr>
  <td colspan="2"><center><a href="new_login.asp">Are you a new user?</a></center></td>
</tr>
</table></form>
</body>
</html>

Thanks in advance!!

Thanks!

nvillare
__________________
Thanks!

N
Reply With Quote
  #2 (permalink)  
Old August 4th, 2003, 08:09 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

What "difficulty" are you having?
Please tell us what the error message is or a specific problem.
If you got the connection from another have you changed the DB name and path to your own?


======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
Reply With Quote
  #3 (permalink)  
Old August 5th, 2003, 08:00 AM
Authorized User
 
Join Date: Jul 2003
Location: Houston, Texas, USA.
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nvillare
Default

Error Message:

There is a problem with the page you are trying to reach and it cannot be displayed.

HTTP 500 - Internal server error
Internet Explorer

I already changed the db name to mine.

Thanks

Thanks!

nvillare
Reply With Quote
  #4 (permalink)  
Old August 5th, 2003, 08:27 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

This is a friendly error message.
In your browser go to
TOOLS > INTERNET OPTIONS > ADVANCED
and uncheck "Show freindly http error messages"
Try the page again and then post the new error message here.

======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
Reply With Quote
  #5 (permalink)  
Old August 5th, 2003, 09:13 PM
Registered User
 
Join Date: Jul 2003
Location: , NY, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to tcasp
Default

Did you create any recordset object?

Reply With Quote
  #6 (permalink)  
Old August 6th, 2003, 09:38 AM
Authorized User
 
Join Date: Jul 2003
Location: Houston, Texas, USA.
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nvillare
Default

I am doing this from and I do not have access to change the features to user friendly error messages.

Thanks!

nvillare
Reply With Quote
  #7 (permalink)  
Old August 6th, 2003, 07:49 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

tcasp seems to have spotted the problem you for you, you need the line:
set RSLogin = Conn.execute(mySQL)
before:
if RSLogin.EOF then

But, you change the friendly http error messages in your Browser window settings, friendly errors as nothing to do with your application.
You have access to it via Internet Explorer (TOOLS > INTERNET OPTIONS > ADVANCED ).
You will need to do this for developement in general as you need to know what the errors are.

Rod


======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
Reply With Quote
  #8 (permalink)  
Old August 7th, 2003, 11:12 AM
Authorized User
 
Join Date: Jul 2003
Location: Houston, Texas, USA.
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nvillare
Default

I added the set RSLogin - MyConn.execute(mySQL)

it still does not work. I changed a few things like the connection to go with brinkster.com. Can someone please advice on what I am doing wrong? I appreciate your help and input!!

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'checks for absence of the sign in button
if isempty(Request.Form("login")) then
 'if absent then it is the first attepmt
 Session("NumAttempts") = 1
  'variable is created
  TheMessage = "Please Login:"
  else

  set MyConn = Server.CreateObject ("ADODB.Connection")
  MyConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="& Server.MapPath("nvillare\db\geo.mdb"))

  mySQL = "SELECT ID, firstName, email FROM LogIn WHERE " _
  & "email = '" & Request.Form("email") & "' and " _
  & "passwordd = '" & Request.Form("password") & "'")

  set RSLogin = MyConn.execute(mySQL)
  if RSLogin.EOF then
   Session("NumAttepmts") = Session("NumAttempts") + 1
   if Application("NumAttempts") = 0 then
     TheMessage = "Login not found, please try again:"
    'compares number of login attempts to number allowed
    elseif Session("NumAttempts") > Application("NumAttempts") then
      TheMessage = "Login not found. No more attempts allowed."
      else
      TheMessage = "Login not found, please try again:"
      end if
    else
    'session variables are created to store information about the visitor
      Session("ID") = RSLogin("ID")
      Session("firstName") = RSLogin("firstName")
      Response.Redirect "index.asp"

'to call the username during the session
'<%= session("firstName")
%>
<html>
<head>
<title>Practice</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p><center><% Response.Write TheMessage %></center></p>
<%
if TheMessage <> "Login not found. No more attempts allowed." then
%>

<form action="login.asp" method="post">
<p><center>Please Login:</p>
<table>
<tr>
  <td>Email:</td>
  <td><input type="text" name="email" maxlength="25" size="30"></td>
</tr>
<tr>
  <td>Password:</td>
  <td><input type="password" name="password" maxlength="8" size="30"></td>
</tr>
<tr>
  <td><img src="shim.gif" width="20%"></td></tr>
<tr>
  <td colspan="2" align="center" valign="middle"><input type="submit" value="Login" name="login"></td>
</tr>
<tr>
  <td><img src="shim.gif" width="20%"></td></tr>
<tr>
  <td colspan="2"><center><a href="new_login.asp">Are you a new user?</a></center></td>
</tr>
</table></center>
</form>
<%
  end if
%>
</body>
</html>



Thanks!

nvillare
Reply With Quote
  #9 (permalink)  
Old August 12th, 2003, 09:06 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

nvillare,

You appear to be missing a few END IF statements.
I can see 4 IF statements and only 2 END IF's.

HOWEVER,

I am not familiar with the details of brinkster but I am sure you can change you error message settings.

It is on your browser, not the brinkster server.

 
Quote:
quote:
Quote:
In your browser go to
TOOLS > INTERNET OPTIONS > ADVANCED
and uncheck "Show freindly http error messages"
Try the page again and then post the new error message here.
You see the error could be from anywhere, it might be database related, an unassigned session variable or a small syntax error.

The code below shows where you are missing END IF's
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'checks for absence of the sign in button
'********************************************
'The next IF has no END IF
'********************************************
if isempty(Request.Form("login")) then
     'if absent then it is the first attepmt
     Session("NumAttempts") = 1
      'variable is created
      TheMessage = "Please Login:"
else

      set MyConn = Server.CreateObject ("ADODB.Connection")
      MyConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ="& Server.MapPath("nvillare\db\geo.mdb"))

      mySQL = "SELECT ID, firstName, email FROM LogIn WHERE " _
      & "email = '" & Request.Form("email") & "' and " _
      & "passwordd = '" & Request.Form("password") & "'")

      set RSLogin = MyConn.execute(mySQL)

      '********************************************
      'The next IF has no END IF
      '********************************************
      if RSLogin.EOF then
              Session("NumAttepmts") = Session("NumAttempts") + 1
              if Application("NumAttempts") = 0 then
                 TheMessage = "Login not found, please try again:"
                'compares number of login attempts to number allowed
              elseif Session("NumAttempts") > Application("NumAttempts") then
                  TheMessage = "Login not found. No more attempts allowed."
              else
                  TheMessage = "Login not found, please try again:"
             end if
      else
            'session variables are created to store information about the visitor
            Session("ID") = RSLogin("ID")
            Session("firstName") = RSLogin("firstName")
            Response.Redirect "index.asp"

            'to call the username during the session
            '<%= session("firstName")
            %>
            <html>
            <head>
            <title>Practice</title>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
            </head>

            <body>
            <p><center><% Response.Write TheMessage %></center></p>
            <%
            if TheMessage <> "Login not found. No more attempts allowed." then
            %>

                <form action="login.asp" method="post">
                <p><center>Please Login:</p>
                <table>
                <tr>
                  <td>Email:</td>
                  <td><input type="text" name="email" maxlength="25" size="30"></td>
                </tr>
                <tr>
                  <td>Password:</td>
                  <td><input type="password" name="password" maxlength="8" size="30"></td>
                </tr>
                <tr>
                  <td><img src="shim.gif" width="20%"></td></tr>
                <tr>
                  <td colspan="2" align="center" valign="middle"><input type="submit" value="Login" name="login"></td>
                </tr>
                <tr>
                  <td><img src="shim.gif" width="20%"></td></tr>
                <tr>
                  <td colspan="2"><center><a href="new_login.asp">Are you a new user?</a></center></td>
                </tr> 
                </table></center>
                </form>
            <% 
            end if 
            %>
</body>
</html>


======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help - How to create a Login tracker? melvados Visual Basic 2005 Basics 3 August 4th, 2008 09:07 AM
How to create the login curiaquita VB.NET 4 June 4th, 2008 07:13 AM
how to create login page using asp.net prakashbabu ASP.NET 2.0 Basics 1 March 7th, 2007 11:52 AM
Newbie Help. Login to unique login page per user Kainan Classic ASP Professional 10 May 3rd, 2005 07:47 AM
How to create Cookies and use login page +checkbox lily611 General .NET 6 October 12th, 2004 01:59 PM



All times are GMT -4. The time now is 12:44 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.