Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6791165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:48:46+00:00 2026-05-26T17:48:46+00:00

I posted a question last night, but unfortunately I was not specific enough vis

  • 0

I posted a question last night, but unfortunately I was not specific enough vis a vis the situation I have found myself in. I have been given a homework assignment in which we are to create a ‘comments’ section for a blog. However, for the user to leave a comment, they must enter a captcha. Our task is to use cookies to track login attempts.

What I failed to explain properly in my original qestion is:

We must use cookies. This is an exercise aimed specifically at cookie implementation. It is not best practice, in is vulnerable. Our instructor has explained why we should not do this in a ‘real world’ situation, but he wants us to understand and demonstrate the use of cookies.

I posted a question last night, but unfortunately I was not specific enough vis a vis the situation I have found myself in. I have been given a homework assignment in which we are to create a ‘comments’ section for a blog. However, for the user to leave a comment, they must enter a captcha. Our task is to use cookies to track login attempts.

What I failed to explain properly in my original qestion is:

We must use cookies. This is an exercise aimed specifically at cookie implementation. It is not best practice, in is vulnerable. Our instructor has explained why we should not do this in a ‘real world’ situation, but he wants us to understand and demonstrate the use of cookies.

We need to allow the user as many chances as they wish to login. However, if they try five times within a 30 second window, they are locked out for three minutes.

Most folks mentioned that I should use session, which makes sense. However, it is not allowed.

At a high level, all you need to do is to store the timestamps instead of the “count”. Then on each request you can toss away timestamps older than 30 seconds and count the rest.

We need to allow the user as many chances as they wish to login. However, if they try five times within a 30 second window, they are locked out for three minutes.

Most folks mentioned that I should use session, which makes sense. However, it is not allowed. One user mentioned that all I need to do is store the timestamps instead of the ‘count’, and then toss away timestamps older than 30 seconds and count the rest. This makes sense, but how do you achieve this practically?

This is a homework question, I certainly don’t expect code. I am just looking for some clarity into the whole ‘cookie thing’. Should I store timestamps in an array? If so, how do you do this? If time exceeds 30 seconds, how do I delete them out of the array?

I think I am suffering from a bit of a lack of understanding of cookies in general. Any clarification would be greatly appreciated. I hope I have been succinct with out wasting anyones valuable time. Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:48:47+00:00Added an answer on May 26, 2026 at 5:48 pm

    My suggestion would be that if you must use cookies, you can simply set individual cookies as flags for failed attempts with expire times of 30 seconds, and if all 4 failed attempt flags are present and they fail again, set another flag cookie that expires in 3 minutes and disallows any attempts while that flag is set.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I posted a question last night about Java Reflection and am discovering compiler warnings
I posted a question re LDAP account management, but after exploring this, it's not
I posted this question last week, but I wasn't very clear on what was
in a related question I have posted this code. It almost works, but the
I have a query which I got help with last night but I am
Last night I asked a question like this, I'm not sure what's happening and
I posted a question about keys yesterday, and got very helpful responses. I've been
I posted this question on Reddit Programming and did not get a single response.
I recently posted a question about getting last 3 results in table in the
I have posted a question few days ago about Querying on collections with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.