...

View Full Version : ASP Log off script



techno_monkey
01-11-2005, 08:03 PM
Hi there

Could someone please give ma a log off script in asp. The logon section of the script is below:

<%
dim db
set db = Server.CreateObject("ADODB.Connection")
db.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("project.mdb")
dim strEmail, strPassword
strUsername = Request("username")
strPassword = Request("Password")

dim rsUsers
dim sql
set rsUsers = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM tblmember WHERE username = '" & strUsername & "';"
rsUsers.Open sql, db

if not rsUsers.EOF then 'User was found - check password
if UCase(rsUsers("Password")) = UCase(strPassword) then
dim strName, value
for each sField in rsUsers.Fields
strName = sField.Name
value = sField.value
next

session("username")=request("username")
Session("UserLoggedIn") = True

'redirect the user to the "validated" page
Response.Redirect "validated.asp"
else

Session("username") = Request("username")
Response.Redirect "validate.asp?Again=1&BadPW=True"
end if
else
Session("username") = Request("username")
if Request("Again") = "1" then
Response.Redirect "validate.asp?Again=1"
else
response.redirect "validate.asp?Again=1"
end if
end if

%>


Many thanks in advance!!

Darren

Bullschmidt
01-12-2005, 05:05 AM
Session.Abandon

ghell
01-12-2005, 09:50 AM
really you should use cookies as they are much better for the server than sessions, these should probably be added to things like the data in a certain format in a single string and encrypted before sending them to the client (as the client can read them in firefox, notepad or whatever)

techno_monkey
01-12-2005, 03:49 PM
Thanks for that

EDIT: Problem fixed



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum