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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to validate a userID from a database 1

Status
Not open for further replies.

ScottNomus

Programmer
Jun 27, 2001
33
US
I have a form that user puts in his or her Username and password. They then submit the page and the database is subposed to validate it here is the code for the user login

<html>
<head>
<title>Frm_Password</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<div align=&quot;center&quot;>
<p><img src=&quot;../images/Nomus%20Logo%20.JPG&quot; width=&quot;335&quot; height=&quot;256&quot;></p>
<Form Method=Post Action=&quot;&quot;>
<p>User Name
<input type=&quot;text&quot; name=&quot;textfield&quot;>
</p>
<p>Password
<input type=&quot;text&quot; name=&quot;textfield2&quot;>
</p>
</form>
<form name=&quot;form2&quot; >
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;LogIn&quot;>
<input type=&quot;submit&quot; name=&quot;Submit2&quot; value=&quot;Reset&quot;>
</form>
<p> </p>
</div>

<%
Session.timeout = 20
If IsObject(Session(&quot;WebCustomer_conn&quot;)) Then
Set conn = Session(&quot;WebCustomer_conn&quot;)
Else
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.open &quot;WebCustomer&quot;,&quot;Admin&quot;,&quot;&quot;
Set Session(&quot;WebCustomer_conn&quot;) = conn
End If
%>
<SCRIPT LANGUAGE=VBScript>

<%
If IsObject(Session(&quot;RS_Frm_Password_customer&quot;)) Then
Set tempRS = Session(&quot;RS_Frm_Password_customer&quot;)
Else
set RSUsername = &quot;SELECT User_table.Company, User_table.CompanyNum FROM User_table ORDER BY User_table.Company &quot;
Set tempRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
tempRS.Open sql, conn, 3, 3
Set Session(&quot;RS_Frm_Password_customer&quot;) = tempRS
tempRS.MoveFirst
End If
tempRS.MoveLast
%>

<body bgcolor=&quot;#FFFFFF&quot;>

</body>
</html>
****END****
I also need to know how to put astriks in the password field instead of showing the password

Thanks
 
This is an correct example from your code
If u want to submit something put all variables in one form not in two (see submit button)

<html>
<head>
<title>Frm_Password</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<div align=&quot;center&quot;>
<p><img src=&quot;../images/Nomus%20Logo%20.JPG&quot; width=&quot;335&quot; height=&quot;256&quot;></p>
<Form Method=Post Action=&quot;myasppage.asp&quot;>
<p>User Name
<input type=&quot;text&quot; name=&quot;textfield&quot; id=&quot;textfield&quot;>
</p>
<p>Password
<input type=&quot;password&quot; name=&quot;textfield2&quot; id=&quot;textfield2&quot;>
</p>
<input type=&quot;submit&quot; value=&quot;LogIn&quot;>
<input type=&quot;reset&quot; value=&quot;Reset&quot;>
</form>
</div>
</html>

(* u mut put the name and the id to the objects cuz u may heve problem in other browsers than IE *)

-for text u coul use just <input name=&quot;&quot; id=&quot;&quot;> or <input type= &quot;text&quot; name=&quot;&quot; id=&quot;&quot;>
-for *(password char) use <input type= &quot;password&quot; name=&quot;&quot; id=&quot;&quot;>
-for submit use <input type= &quot;submit&quot;> u dont need name and id if u dont use ascripts for them
-for reset use <input type= &quot;reset&quot;>

and in action page (from your form tag) myasppage.asp
u have to get the user name and password
and then put your code to work...

<%
username=Request.Form(&quot;textfield&quot;)
pass=Request.Form(&quot;textfield2&quot;)
'veryfy pass an user name
Session.timeout = 20
If IsObject(Session(&quot;WebCustomer_conn&quot;)) Then
Set conn = Session(&quot;WebCustomer_conn&quot;)
Else
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.open &quot;WebCustomer&quot;,&quot;Admin&quot;,&quot;&quot;
Set Session(&quot;WebCustomer_conn&quot;) = conn
End If
%>
<SCRIPT LANGUAGE=VBScript>

<%
If IsObject(Session(&quot;RS_Frm_Password_customer&quot;)) Then
Set tempRS = Session(&quot;RS_Frm_Password_customer&quot;)
Else
set RSUsername = &quot;SELECT User_table.Company, User_table.CompanyNum FROM User_table ORDER BY User_table.Company &quot;
Set tempRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
tempRS.Open sql, conn, 3, 3
Set Session(&quot;RS_Frm_Password_customer&quot;) = tempRS
tempRS.MoveFirst
End If
tempRS.MoveLast
%>

<body bgcolor=&quot;#FFFFFF&quot;>

</body>
</html>


Hope this help's u..
________

George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top