Needing Help with Cookies

Results 1 to 4 of 4

Thread: Needing Help with Cookies

  1. #1
    Join Date
    Dec 1969
    Posts
    52

    Default Needing Help with Cookies

    Needing Help with ASP <BR>Message: I need a bit of help here...I&#039ve set up a forum for artists to post their art and vote for others and other sorts of stuff...I want to limit the number of votes allowed per month so I figured a cookie would do this best...So I set them up for 8 votes per month, however it seems that when I tested this setup, whenever I restarted my PC, I got a whole new 8 votes...so I guess my question is how do I setup the cookie to add a vote to the cookie each time someone votes and not allow them to vote if that number of votes is 8 already..here is how I have it now though..it seems to work, but the cookie seems to disappear whenever I reboot the computer that has a cookie..<BR><BR>this is the meaning of BaseDate<BR>--------------------<BR>BaseDate = date<BR>---------------------------<BR><BR>this is the meaning of EndOfMonth<BR>-----------------<BR>EndOfMonth = DateSerial(Year(BaseDate), Month(BaseDate) + 1, 0)<BR>------------------------<BR><BR>this is the code that adds to the cookie or makes a cookie depending on votes<BR>------<BR>If Request.Cookies("Votes") = "" then<BR>Response.Cookies("Votes") = 1<BR>Response.Cookies("Votes").Expires = EndOfMonth<BR>Else<BR>Response.Cookies("Votes") = Request.Cookies("Votes") + 1<BR>Response.Cookies("Votes").Expires = EndOfMonth<BR>-------------------<BR><BR>and here is the code that checks if 8 votes are recorded and if so goes to a page telling them sorry no more votes, or if not then it goes through with the vote<BR>--------------------------<BR>If Request.Cookies("Votes") = "8" then<BR>Response.Clear<BR>Response.Redirect "toomany.html"<BR>Else<BR>blahblahblah<BR>----------------------------------<BR><BR>also is there anyway to just get the first two sections of a visitor&#039s IP such as 234.12.x.x instead of the entire thing...I would like to deny them access to voting for their own image...and since most visitors have dynamic IPs I need this ability..!...Thanks..<BR><BR>Hope someone can help..please email replies if possible to rdraper@tla.com...By the way..I&#039m pretty new to all this ASP, so don&#039t break me to hard..!<BR>Roy <BR>

  2. #2
    Ian Stallings Guest

    Default RE: Needing Help with Cookies

    try adding this:<BR>Response.Cookies("Votes").Domain = www.yourdomain.com<BR><BR><BR>when you set the cookie and access it.<BR><BR>hope this helps :)

  3. #3
    Join Date
    Dec 1969
    Posts
    52

    Default RE: Needing Help with Cookies

    Many thanks..I&#039ll test it out!

  4. #4
    ActiveALLI Guest

    Default RE: Needing Dynamic IP's

    left(Request.ServerVariables("HTTP_HOST"),7)<BR><B R>this is 194.214 ... first 7 numbers ...


Posting Permissions

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