Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 7th, 2006, 01:18 PM
Authorized User
 
Join Date: Nov 2006
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via Yahoo to webXtreme
Default Simple Logout Script

I have a simple web page where the user must log-in before viewing any of the pages posted. However, I want them to click the logoff link to clear all cookies and redirect them to another page. Can someone take a look at this and let me know if I'm missing something!!! It looks right to me. Here's my code:

LOG-IN VALIDATE USER CODE:
*************************************************
' execute sql and open as recordset
sqlStr = "Select * FROM usrpssd where username = '" _
            & Request.Form("username") & "' and password = '" & Request.Form("password") & "'"

' Opens the returned values from the SQL as a recordset, ready for iteration by ASP
set rcSet = cnStr.Execute(sqlStr)

' validate variables against database
If (not rcSet.BOF) and (not rcSet.EOF) then
response.cookies("validated_user") = frmUsername
response.redirect("/htm/default.asp")

else
response.redirect("/htm/login/error.asp")
end if
%>
************************************************** ***********

LOGOFF USER CODE (this is the code I'm having trouble with):
************************************************** ***********

<%

if response.cookies("validated_user") = frmUsername then
response.cookies("validated_user") = ""
response.redirect("/htm/login/logoff.asp")
end if

%>

__________________
webXtreme





Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Login Logout Apocolypse2005 PHP Databases 1 September 25th, 2008 01:17 AM
ASP Logout Script webXtreme Access ASP 0 November 7th, 2006 02:40 PM
logout TIME and logout DATE crmpicco Classic ASP Databases 2 January 20th, 2005 12:01 AM
logout TIME and logout DATE crmpicco Classic ASP Basics 0 January 19th, 2005 07:57 AM
multiple word query on simple phpMysql script peter_G PHP Databases 9 December 2nd, 2004 10:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.