PDA

View Full Version : Password Error Message


Abd
10-05-2002, 03:10 PM
Hi All,

thanks whammy BigDaddy and the rest, now how do I dispaly a meaningful error page if a user types an invalid password. My code select from database, store in a Recordset, and checks what the user type against the recordset value. But I keep having problem in displaying an error page, help needed. Below is my code;

<%
username = TRIM( Request.Form( "username" ) )




IF username <> "" THEN
Set Con = Server.CreateObject( "ADODB.Connection" )
Con.Open "DRIVER={SQL SERVER};SERVER=server_live;UID=sa;PWD=pass;DATABASE=rep"
Set RS= Server.CreateObject( "ADODB.Recordset" )

If username <> "" then
RS.Open "select branch_code,branch_name,acct_number,username,password from branch where password = '" &username& "'", Con
BnchCD = RS.Fields("branch_code")
BranchName = RS.Fields("branch_name")
acct = RS.Fields("acct_number")
username = RS.Fields("username")
password = RS.Fields("password")

if password != username Then
Response.Redirect"http://cyber/ite/def.asp"
end if



End if
Con.Close
Set RS = Nothing
Set Con = Nothing
END IF
%>


<Html>
<head><title>Modify Data</title>


<body background="backg.gif">
<form name="form1" method="post" action="modify2ntl.asp?category=<%=category%>">
<h1 align="center"><font color="blue" size=+2><em>Clients Operations - Non Accounting</em></font></h1>
<p>
<p>
<b>Branch Code:</b>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="BnchCD" type="text" value="<%=Server.HTMLEncode(BnchCD)%>" readonly>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<b>Branch Name:</b>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="BranchName" type="text"value="<%=Server.HTMLEncode(BranchName)%>" readonly>
<p>
<b>Operator:</b>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="user" type="text"value="<%=Server.HTMLEncode(username)%>" readonly>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<b>Account Nmber:</b>
&nbsp;&nbsp;&nbsp;<input name="acct" type="text"value="<%=Server.HTMLEncode(acct)%>" readonly>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p>
<b>Transaction Date:</b>
&nbsp;<input name="tDate" type="text"value="<%=date%>" readonly>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<b>Validation Date:</b>
&nbsp;&nbsp;&nbsp;<input name="valDate" type="text"value="<%=date%>" readonly>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p>
<b>Type of Payment:</b>
&nbsp;&nbsp;<select name="tpay">
<option>Cash </option>
<option>Cheque </option>
</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<b>Amount:</b>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="amount" type="text" value="<%=Server.HTMLEncode(amount)%>" size="20">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<p>
<b>Amount Drawn:</b>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="amountdrawn" type="text" value="0" size="20">
<p><center><input type="submit" value="Commit" onClick="return Submit()"> </center>
</form>
<a href="defntl2.asp"><FONT FACE='COMIC Sans MS' COLOR=blue size=1><h4 align="right"><big>Menu</big></h4></FONT></a>
</body>
</html>

BigDaddy
10-05-2002, 06:20 PM
I'm guessing by reading your other thread you got this part, but this should be changed:

if password != username Then
Response.Redirect"http://cyber/ite/def.asp"
end if


to:

if password <> username Then
Response.Redirect"http://cyber/ite/def.asp"
end if