========== VERY URGENT: C O O K I E______P R O B

Results 1 to 2 of 2

Thread: ========== VERY URGENT: C O O K I E______P R O B

  1. #1
    SchmeergeeZ Guest

    Default ========== VERY URGENT: C O O K I E______P R O B

    Hi,<BR><BR>I&#039ve a cookie problem.<BR>I use the POLL of 4 Guys.... and in this script the cookie expires after one day, but I want that the cookie expires when the question expires (from database Poll.mdb Poll.DateEnd) (THERE ARE MORE QUESTIONS IN THE DATABASE!!). IS THIS POSSIBLE????<BR><BR>PLEASE HELP! THIS IS THE POLLRESULTS.ASP SCRIPT<BR><BR>------------------------------------------------<BR><BR>&#060;%@ Language=VBScript %&#062;<BR>&#060;% Option Explicit %&#062;<BR>&#060;%<BR><BR>Response.ExpiresAbsolu te = Now() - 1<BR><BR>&#039All we want to do here is increment the vote count for<BR>&#039 the voting option selected...<BR><BR> Dim objConn<BR> Set objConn = Server.CreateObject("ADODB.Connection")<BR> objConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & _<BR> Server.MapPath("Poll.mdb") & ";"<BR> objConn.Open<BR> <BR> Dim objRS<BR> Set objRS = Server.CreateObject("ADODB.Recordset")<BR><BR><BR> &#039Read in our PollOptionID variable<BR>Dim iPollOptionID<BR>iPollOptionID = CInt(Request("radPoll"))<BR><BR><BR>objConn.Execut e "UPDATE PollOption SET Votes = Votes + 1 " & _<BR> "WHERE PollOptionID = " & iPollOptionID<BR><BR><BR>&#039Clean Up...<BR>objConn.Close<BR>Set objConn = Nothing<BR>&#039We&#039ve gotta write a cookie<BR>Response.Cookies("Voted") = "Yes"<BR>Response.Cookies("Voted").Expires = DateAdd("d",1,Date)<BR><BR>&#039Send the user back to the previous page<BR>Response.Redirect Request("URLFrom")<BR><BR>%&#062;<BR>------------------------------------------------<BR><BR>Response.Cookies(Voted).Expires = DateAdd("d",1,dtDateEnd)<BR><BR>Doesn&#039t work!<BR><BR><BR>TNX<BR>

  2. #2
    peterjl@austec.net.au Guest

    Default RE: ========== VERY URGENT: C O O K I E______P R

    All you need to do is change this line:<BR><BR>Response.Cookies("Voted").Expires = DateAdd("d",1,Date)<BR><BR>to <BR><BR>Response.Cookies("Voted").Expires = objRS ("DateExpires")<BR><BR>I don&#039t know what field you use for the expiry date. You will obviously need to substitute you field name where I have [DateExpires].<BR><BR>you may have to make sure that the format of [DateExpires] is compatable with the servers native date format. I would suggest that you convert the date to the form, "01-Jan-2000", to make it unambiguous. If the date is in form, "12-01-2000", this may be interpreted as 12-Jan or 1-Dec, depending on how the server is setup.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts