PDA

View Full Version : Login using database through SQL statement


scriptblur
09-09-2002, 08:08 AM
Hi there,
Is there any kind souls can help me???

Currently i have a problem on the login process that is using database with a SQL statement....
When i login and it will interact with the database through the SQL statement???


Is there any sample for reference.... thank a lot...

Morgoth
09-09-2002, 05:52 PM
A sample for a login script, is that what you need?

I knwo fo one that involves cookies.
Whammy has one.

Registration/Login Script (ASP/VBScript)
http://www.solidscripts.com/default.asp

See if it helps you.
There are also other sites to check out.
Try http://aspin.com for some login scripts :)

whammy
09-09-2002, 11:39 PM
Direct link:

http://www.solidscripts.com/ASP/login.zip

(In other words, you don't *have* to register to get this file if you don't really want to).

P.S. A login script can be really simple (although mine is a little more complex, storing the real user's name, and requiring them to answer an email in order to confirm their registration - and also checking for duplicate usernames when someone registers.) - all you need for a BASIC script is a database with two fields, user and pass.

When someone logs in, you just check like:

set rs = Conn.Execute("SELECT * from tablename WHERE user = '" & user & "' AND pass = '" & pass "'")

If NOT rs.EOF Then
Response.Cookies("login") = "OK"
Response.Redirect("members.asp")
Else
Response.Redirect "login.asp"
End If

Then on members.asp just include a little snippet (which of course can be an include file):
<%
If Response.Cookies("login") <> "OK" Then Response.Redirect("login.asp")
%>

:D

scriptblur
09-10-2002, 01:48 AM
Ok... thnk alot.....