Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP 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 11th, 2003, 09:25 AM
Authorized User
 
Join Date: Oct 2003
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
Default delete cookies

Hi,

Thanks for the response. I tried your way but probably i didn't understand it so it didn't work. However, I tried another way and it seems to work fine. The cookie gets deleted. Before what happened was that it only recognised the first username and password entered and if i entered a different username and passwork then it didn't recognise it.
 I am not sure that this is what my team leader meant but this is what i did and it seems to work fine:
DIM ACCESS
DIM U_ID
DIM U_PWORD
set rsACCESS = Server.CreateObject("ADODB.Recordset")
rsACCESS.ActiveConnection = MM_connDUclassified_STRING
rsACCESS.Source = "SELECT U_ID,U_PASSWORD, ACCESS FROM USERS WHERE U_ID = '" + CStr(Request.Form("Username")) + "'"
rsACCESS.CursorType = 0
rsACCESS.CursorLocation = 2
rsACCESS.LockType = 3
rsACCESS.Open()
rsACCESS_numRows = 0
access=(rsACCESS.fields.item ("ACCESS").value)
 u_id=(rsACCESS.fields.item ("u_id").value)
 U_PWORD=(rsACCESS.fields.item ("u_password").value)
     '---create user cookie

    if ACCESS="user" then
   Response.Cookies("adminCOOKIE").Path = "/"
       Response.Cookies("adminCOOKIE")=""
     Response.Cookies("adminCOOKIE").Expires=date ()-100
    Response.Cookies("UserCookie")("Username") =Request.Form("UserName")
    Response.Cookies ("UserCookie")("Password")=Request.Form ("Password")
    Response.Cookies("UserCookie").Path = "/"
    Response.Cookies ("UserCookie").expires = DateAdd("d", Date, 14)
    Response.Write(Request.Cookies("UserCookie")("User name"))
    Response.Write (Request.Cookies("UserCookie")("Password"))

    '---end user cookie
        else
    'create admin cookie

    Response.Cookies("UserCOOKIE")=""
      Response.Cookies("UserCookie").Path = "/"
     Response.Cookies("UserCookie").Expires=date ()-100
    Response.Cookies("adminCOOKIE")("ADMINusername") = Request.Form("UserName")
    Response.Cookies ("adminCOOKIE")("ADMINPassword")=Request.Form ("Password")
    Response.Cookies("adminCOOKIE").Path = "/"
    Response.Cookies ("adminCOOKIE").expires =dateadd("m",20,now())
    Response.Write(Request.Cookies("adminCOOKIE")("ADM INusername"))
    Response.Write (Request.Cookies("adminCOOKIE")("ADMINPassword"))

    '---end admin cookie

' end if
   end if
   rsACCESS.close
    %>

 
Old November 11th, 2003, 09:26 AM
Authorized User
 
Join Date: Oct 2003
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
Default

oops, this message is in the wrong place it is supposed to be under my previous post titled 'delete cookies'






Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to delete file System.IO.Delete error maricar C# 13 March 14th, 2014 06:50 AM
php/mysql delete button and delete query dungey PHP Databases 17 April 11th, 2009 12:24 PM
how to delete a row when click delete hyperlink naveenkumarg1 Pro JSP 1 August 16th, 2004 01:29 AM
Help!About Cookies jelsen ASP.NET 1.0 and 1.1 Basics 2 September 9th, 2003 08:36 AM





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