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

need to verify username and password from Access DB

Status
Not open for further replies.

gus121

Technical User
May 9, 2002
298
0
0
GB
need to verify username and password from Access DB have tried to use ASP VB SQL script combined with Client side JavaScript but to know avail. I do not need a high level of security. Can any one help me have they got some custom made script I can borrow or know where i can get it? thanks
 
hi
this is a script i wrote for my application
enjoy

<%
loginCookie = request.cookies (&quot;ltlsUser&quot;)


if loginCookie <> &quot;&quot; then ' ### checking if a cookie exsit ###''

response.redirect (&quot;main.asp&quot;)

else
' ### start checking for user & password and write cookies ### '

if request(&quot;login&quot;) <> &quot;&quot; then ' ### check if the user pressed the login button ###'

userName = request(&quot;user&quot;) ' ### get the userName from the form ###''
password = request(&quot;pass&quot;) ' ### get the password from the form ###''

' ### create recordset for check the user name ###'
set rsStudentCheck = server.CreateObject (&quot;ADODB.Recordset&quot;)
sqlStudentCheck = &quot;SELECT * FROM tblStudents WHERE (user='&quot; & (userName) &&quot;');&quot;
rsStudentCheck.Open sqlStudentCheck, conn

' ### check password ###'
if rsStudentCheck.EOF then
response.write _
&quot;<br><table class=tblEdit align=center>&quot; &_
&quot;<tr><td align=center>&#728;&#204;&#8224;&#8240;&#211;&#728;&#729;&#211;&#728;&#8224;&#728;&#8218;&#194;&#200;<br><a href=index.asp>&#63743;&#210;&#8240;&#8224;&#728;&#194;·</a></td></tr>&quot; &_
&quot;</table>&quot;

else
if rsStudentCheck(&quot;password&quot;) <> password then

response.write _
&quot;<br><table class=tblEdit align=center>&quot; &_
&quot;<tr><td align=center>&#210;&#200;&#210;&#211;&#8225;&#8224;&#728;&#8218;&#194;&#200;&#8240;<br><a href=index.asp>&#63743;&#210;&#8240;&#8224;&#728;&#194;·</a></td></tr>&quot; &_
&quot;</table>&quot;

else

response.cookies (&quot;ornmStdntUser&quot;) = userName
response.cookies (&quot;ornmStdntPass&quot;) = password
response.cookies (&quot;ornmStdntPass&quot;).expires = now() + 365
response.cookies (&quot;ornmStdntUser&quot;).expires = now() + 365
response.redirect (&quot;main.asp&quot;)

end if
end if
' ### end password check ###'

else

' ###login tables ###'
response.write _
&quot;<br><table align=center border=1 bordercolor=black cellpadding=0 cellspacing=0 >&quot; &_
&quot;<tr align=center class=tblItem><td colspan=2><b><u>&#206;&#63743;&#200;&#210;&#729;&#8224;&#193;&#63743;&#200;&#205;</u></b></td></tr>&quot; &_
&quot;<form action=index.asp method=post>&quot; &_
&quot;<tr align=right class=tblTdBG><td> <b>&#728;&#204;&#8224;&#211;&#728;&#729;&#211;&#728;</b><br></td><td><input type=text name=user size=20 maxlength=20></td></tr>&quot; &_
&quot;<tr align=right class=tblTdBG><td> <b>&#210;&#200;&#210;&#211;&#8225;</b><br></td><td><input type=password name=pass size=20 maxlength=20></td></tr>&quot; &_
&quot;<tr align=center class=tblItem><td colspan=2><input type=submit class=submit name=login value=&quot;&quot;&#206;&#63743;&#200;&#210;&#8240; &#207;&#211;&#218;&#175;&#206;&#729;&quot;&quot;></td></tr>&quot; &_
&quot;</form>&quot; &_
&quot;</table>&quot; ' ### end login menu

end if
' ### end checking for user & password and write cookies ### '

end if
%> shai dayan
 
Can you use an html form and do the processing in asp? If you can, you will not need to use cookies.
This is the code I use.
Here's the first page.html:
<form action=&quot;validatePassword.asp&quot; method=&quot;get&quot; name=&quot;frmLogin&quot;>

<h3>Already a member? Login now.</h3>
<br><br>
<table border=&quot;0&quot;>
<tr>
<td>Username: </td>
<td><input id=&quot;text1&quot; name=&quot;txtUserName&quot;></td></tr>
<tr>
<td>Password: </td>
<td><input type=&quot;password&quot; id=&quot;password1&quot; name=&quot;txtPassword&quot;></td></tr>
</table><br>
<input type=&quot;image&quot; src=&quot;images/img_Submit.gif&quot; value=&quot;Submit&quot; id=&quot;submit1&quot; name=&quot;btnSubmit&quot; WIDTH=&quot;106&quot; HEIGHT=&quot;54&quot;>

Here's validatePassword.asp. I use VI with its recordset dtc, but you can modify it for regular asp use.

rsValidatePassword.setSQLText(&quot;SELECT Table.* &quot; _
& &quot;FROM Table &quot; _
& &quot;WHERE Table.UserName = '&quot; & request.querystring(&quot;txtUserName&quot;) & &quot;'&quot; _
& &quot;AND Table.Password = '&quot; & request.querystring(&quot;txtPassword&quot;) & &quot;'&quot;)
rsValidatePassword.open



Hope that works for you.
 
i use cookies to remmember the visitor. i don't want my users to enter password each time they connect to the application shai dayan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top