|
 |
asp_database_setup thread: ch 24 - plogon.asp in professional asp book
Message #1 by "Michael Shaw" <mshaw@s...> on Tue, 24 Jul 2001 18:56:20
|
|
<%
If Session("LogonCount") > 2 Then
Response.Redirect "Plogonfail.asp?reason=1"
End If
If Request.QueryString("mode")="logon" And _
(Trim(Request.Form("txtEmailAddress")) <> "" And _
Trim(Request.Form("txtPassword")) <> "") Then
vEmailAddress = LCase(Trim(Request.Form("txtEmailAddress")))
vPassword = Trim(Request.Form("txtPassword"))
Set oDB = Server.CreateObject("ADODB.Connection")
oDB.Open
("ODBC;DATABASE=dbTestSite;DSN=dsnTestSite;UID=**;PWD=*******")
vSQL = "select * from Users Where EmailAddress = '" &
vEmailAddress & "'"
Set oRS = oDB.Execute (vSQL)
If Not oRS.Eof then
If vPassword = trim(oRS.Fields("Password")) Then
Select Case trim(oRs.Fields("Status"))
Case "P" :
Response.Redirect "Plogonfail.asp?reason=2"
Case "R" :
Response.Redirect "Plogonfail.asp?reason=3"
Case "M" :
Session("Auth") = "Y"
Session("Name") = trim
(oRS.Fields("Name"))
Session("EmailAddress") =
trim(oRS.Fields("EmailAddress"))
Session("Company") = trim
(oRS.Fields("Company"))
Response.Redirect "Mhome.asp"
End Select
Response.End
End If
Session("LogonCount") = Session("LogonCount") + 1
End If
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Logon</title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" type="text/css" href="file:///C%7C/wrox/Pro%20ASP%
203.0/Chapter%2024/security/public/..%5Cglobal%5Cstyle.css">
<meta name="Microsoft Border" content="tb, default">
</head>
<body><!--msnavigation--><table border="0" cellpadding="0" cellspacing="0"
width="100%"><tr><td>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFFFFF"><img border="0" src="file:///C%7C/wrox/Pro%20ASP%
203.0/Chapter%2024/security/images/wroxdev.gif" width="355"
height="48"></td>
<td bgcolor="#FFFFFF">
<p align="right"><font color="#000000">
<b></b></font></p>
</td>
</tr>
<tr>
<td colspan="2" bgcolor="#000000">
<span style="font-family: Verdana; text-decoration: none; font-size: 10pt">
<img border="0" src="file:///C%7C/wrox/Pro%20ASP%203.0/Chapter%
2024/security/images/menbul.gif" width="15" height="15">
<a style="color: #FFFFFF; text-decoration: none; "
onmouseover="this.style.color='#FF0000'"
onmouseout="this.style.color='#FFFFFF'" href="phome.asp">Home</a>
<img border="0" src="file:///C%7C/wrox/Pro%20ASP%203.0/Chapter%
2024/security/images/menbul.gif" width="15" height="15">
<a style="color: #FFFFFF; text-decoration: none; "
onmouseover="this.style.color='#FF0000'"
onmouseout="this.style.color='#FFFFFF'" href="pbooks.asp">Books</a>
<img border="0" src="file:///C%7C/wrox/Pro%20ASP%203.0/Chapter%
2024/security/images/menbul.gif" width="15" height="15">
<a style="color: #FFFFFF; text-decoration: none; "
onmouseover="this.style.color='#FF0000'"
onmouseout="this.style.color='#FFFFFF'" href="pconfs.asp">Conferences</a>
<img border="0" src="file:///C%7C/wrox/Pro%20ASP%203.0/Chapter%
2024/security/images/menbul.gif" width="15" height="15">
<a style="color: #FFFFFF; text-decoration: none; "
onmouseover="this.style.color='#FF0000'"
onmouseout="this.style.color='#FFFFFF'"
href="pmembers.asp">Members</a></span>
</td>
</tr>
</table>
</td></tr><!--msnavigation--></table><!--msnavigation--><table border="0"
cellpadding="0" cellspacing="0" width="100%"><tr><!--msnavigation--><td
valign="top">
<table border="0" width="100%">
<tr>
<td width="120" valign="top" align="left">
<h5> </h5>
</td>
<td valign="top" align="left">
<h2>Logon</h2>
<form method="POST" action="Plogon.asp?mode=logon">
<table border="0">
<tr>
<td>
<p align="right">Email Address:</p>
</td>
<td><input type="text" name="txtEmailAddress" size="20"
value='<% =Request.Form("txtEmailAddress")
%>' ></td>
</tr>
<tr>
<td>
<p align="right">Password:</p>
</td>
<td><input type="password" name="txtPassword" size="20"
value='<% =Request.Form("txtPassword") %>'
></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Logon" name="butLogon"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<!--msnavigation--></td></tr><!--msnavigation--></table><!--
msnavigation--><table border="0" cellpadding="0" cellspacing="0"
width="100%"><tr><td>
Message #2 by "Ken Schaefer" <ken@a...> on Wed, 25 Jul 2001 12:36:37 +1000
|
|
...and your question is...?
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Michael Shaw" <mshaw@s...>
Subject: [asp_database_setup] ch 24 - plogon.asp in professional asp book
: <%
: If Session("LogonCount") > 2 Then
: Response.Redirect "Plogonfail.asp?reason=1"
: End If
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<code snipped for your viewing comfort>
Message #3 by "Shaw, Mike" <MShaw@s...> on Wed, 25 Jul 2001 08:13:23 -0400
|
|
The code does not send the browser to the correct page in most
circumstances. The failed logon reasons also seem not to work.
Michael Shaw
Web Programmer
Select Medical Corporation
(xxx) xxx-xxxx
mshaw@s...
-----Original Message-----
From: Ken Schaefer [mailto:ken@a...]
Sent: Tuesday, July 24, 2001 10:37 PM
To: ASP Database Setup
Subject: [asp_database_setup] Re: ch 24 - plogon.asp in professional asp
book
...and your question is...?
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Michael Shaw" <mshaw@s...>
Subject: [asp_database_setup] ch 24 - plogon.asp in professional asp book
: <%
: If Session("LogonCount") > 2 Then
: Response.Redirect "Plogonfail.asp?reason=1"
: End If
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<code snipped for your viewing comfort>
Message #4 by "Ken Schaefer" <ken@a...> on Thu, 26 Jul 2001 12:46:56 +1000
|
|
OK, in what circumstances /does/ it work?
What circumstances does it not work?
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Shaw, Mike" <MShaw@s...>
To: "ASP Database Setup" <asp_database_setup@p...>
Sent: Wednesday, July 25, 2001 10:13 PM
Subject: [asp_database_setup] Re: ch 24 - plogon.asp in professional a sp
book
: The code does not send the browser to the correct page in most
: circumstances. The failed logon reasons also seem not to work.
:
: Michael Shaw
: Web Programmer
: Select Medical Corporation
: (xxx) xxx-xxxx
: mshaw@s...
:
:
: -----Original Message-----
: From: Ken Schaefer [mailto:ken@a...]
: Sent: Tuesday, July 24, 2001 10:37 PM
: To: ASP Database Setup
: Subject: [asp_database_setup] Re: ch 24 - plogon.asp in professional asp
: book
:
:
: ...and your question is...?
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "Michael Shaw" <mshaw@s...>
: Subject: [asp_database_setup] ch 24 - plogon.asp in professional asp book
:
:
: : <%
: : If Session("LogonCount") > 2 Then
: : Response.Redirect "Plogonfail.asp?reason=1"
: : End If
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:
: <code snipped for your viewing comfort>
:
: ---
: Search the best ASP Web sites using CodeHound! http://www.codehound.com
: Now it's easy to find ASP source code on the Internet. CodeHound's free
: search engine will categorize your results and even search for ASP code
: compressed in Zip files on the Internet. Stop searching dozens of
: different sites to find what you want...try CodeHound right now!
ken@a...
$subst('Email.Unsub')
Message #5 by "Shaw, Mike" <MShaw@s...> on Thu, 26 Jul 2001 08:58:27 -0400
|
|
Valid information creates no response. For instance, when a credible user
name and password are entered and submitted, the plogon page comes up again.
Purposely entering incorrect logon info does not produce the error message
that is encoded.
Michael Shaw
Web Programmer
Select Medical Corporation
(xxx) xxx-xxxx
mshaw@s...
-----Original Message-----
From: Ken Schaefer [mailto:ken@a...]
Sent: Wednesday, July 25, 2001 10:47 PM
To: ASP Database Setup
Subject: [asp_database_setup] Re: ch 24 - plogon.asp in professional a
sp book
OK, in what circumstances /does/ it work?
What circumstances does it not work?
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Shaw, Mike" <MShaw@s...>
To: "ASP Database Setup" <asp_database_setup@p...>
Sent: Wednesday, July 25, 2001 10:13 PM
Subject: [asp_database_setup] Re: ch 24 - plogon.asp in professional a sp
book
: The code does not send the browser to the correct page in most
: circumstances. The failed logon reasons also seem not to work.
:
: Michael Shaw
: Web Programmer
: Select Medical Corporation
: (xxx) xxx-xxxx
: mshaw@s...
:
:
: -----Original Message-----
: From: Ken Schaefer [mailto:ken@a...]
: Sent: Tuesday, July 24, 2001 10:37 PM
: To: ASP Database Setup
: Subject: [asp_database_setup] Re: ch 24 - plogon.asp in professional asp
: book
:
:
: ...and your question is...?
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "Michael Shaw" <mshaw@s...>
: Subject: [asp_database_setup] ch 24 - plogon.asp in professional asp book
:
:
: : <%
: : If Session("LogonCount") > 2 Then
: : Response.Redirect "Plogonfail.asp?reason=1"
: : End If
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:
: <code snipped for your viewing comfort>
:
Message #6 by "Ken Schaefer" <ken@a...> on Fri, 27 Jul 2001 10:44:24 +1000
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_02C7_01C11689.19C92DB0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
The trick to trouble shooting these types of things is to get some
indication of where your code is falling to, as well as having a default
selection whenever your code branches:
<%
If Session("LogonCount") > 2 Then
Response.Redirect "Plogonfail.asp?reason=3D1"
End If
If Request.QueryString("mode")=3D"logon" And _
(Trim(Request.Form("txtEmailAddress")) <> "" And _
Trim(Request.Form("txtPassword")) <> "") Then
vEmailAddress =3D LCase(Trim(Request.Form("txtEmailAddress")))
vPassword =3D Trim(Request.Form("txtPassword"))
Set oDB =3D Server.CreateObject("ADODB.Connection")
oDB.Open
("ODBC;DATABASE=3DdbTestSite;DSN=3DdsnTestSite;UID=3D**;PWD=3D*******")
vSQL =3D "select * from Users Where EmailAddress =3D '" &
vEmailAddress & "'"
Set oRS =3D oDB.Execute (vSQL)
If Not oRS.Eof then
If vPassword =3D trim(oRS.Fields("Password")) Then
Select Case trim(oRs.Fields("Status"))
Case "P"
' response.Redirect "Plogonfail.asp?reason=3D2"
Response.Write("Case P<br>")
Case "R"
Response.Redirect "Plogonfail.asp?reason=3D3"
Response.Write("Case R<br>")
Case "M"
Session("Auth") =3D "Y"
Session("Name") =3D trim(oRS.Fields("Name"))
Session("EmailAddress") =3D
Trim(oRS.Fields("EmailAddress"))
Session("Company") =3D trim(oRS.Fields("Company"))
' Response.Redirect "Mhome.asp"
Response.Write("Case M<br>")
Case Else
Response.Write("Some other case!<br>")
End Select
Response.End
Else
Response.Write("Password doesn't match!")
End If
Session("LogonCount") =3D Session("LogonCount") + 1
Else
Response.Write("No Recordset")
End If
Else
Response.Write("Mode <> logon")
End If
%>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Shaw, Mike" <MShaw@s...>
To: "ASP Database Setup" <asp_database_setup@p...>
Sent: Thursday, July 26, 2001 10:58 PM
Subject: [asp_database_setup] Re: ch 24 - plogon.asp in professional a
sp book
: Valid information creates no response. For instance, when a credible
user
: name and password are entered and submitted, the plogon page comes up
again.
: Purposely entering incorrect logon info does not produce the error
message
: that is encoded.
:
: Michael Shaw
: Web Programmer
: Select Medical Corporation
: (xxx) xxx-xxxx
: mshaw@s...
:
:
: -----Original Message-----
: From: Ken Schaefer [mailto:ken@a...]
: Sent: Wednesday, July 25, 2001 10:47 PM
: To: ASP Database Setup
: Subject: [asp_database_setup] Re: ch 24 - plogon.asp in professional a
: sp book
:
:
: OK, in what circumstances /does/ it work?
: What circumstances does it not work?
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: ----- Original Message -----
: From: "Shaw, Mike" <MShaw@s...>
: To: "ASP Database Setup" <asp_database_setup@p...>
: Sent: Wednesday, July 25, 2001 10:13 PM
: Subject: [asp_database_setup] Re: ch 24 - plogon.asp in professional a
sp
: book
:
:
: : The code does not send the browser to the correct page in most
: : circumstances. The failed logon reasons also seem not to work.
: :
: : Michael Shaw
: : Web Programmer
: : Select Medical Corporation
: : (xxx) xxx-xxxx
: : mshaw@s...
: :
: :
: : -----Original Message-----
: : From: Ken Schaefer [mailto:ken@a...]
: : Sent: Tuesday, July 24, 2001 10:37 PM
: : To: ASP Database Setup
: : Subject: [asp_database_setup] Re: ch 24 - plogon.asp in professional
asp
: : book
: :
: :
: : ...and your question is...?
: :
: : Cheers
: : Ken
: :
: : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: : From: "Michael Shaw" <mshaw@s...>
: : Subject: [asp_database_setup] ch 24 - plogon.asp in professional asp
book
: :
: :
: : : <%
: : : If Session("LogonCount") > 2 Then
: : : Response.Redirect "Plogonfail.asp?reason=3D1"
: : : End If
: : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: :
: : <code snipped for your viewing comfort>
: :
:
: ---
: Search the best ASP Web sites using CodeHound!
http://www.codehound.com
: Now it's easy to find ASP source code on the Internet. CodeHound's
free
: search engine will categorize your results and even search for ASP
code
: compressed in Zip files on the Internet. Stop searching dozens of
: different sites to find what you want...try CodeHound right now!
ken@a...
$subst('Email.Unsub')
|
|
 |