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

  • Home
  • SEARCH
  • 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 6896163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:00:01+00:00 2026-05-27T07:00:01+00:00

I have a problem which I cannot seem to be able to resolve: I’m

  • 0

I have a problem which I cannot seem to be able to resolve: I’m creating a login process for an application; anytime a user attempts to login and fails, an attempt record is inserted/updated up to 5 attempts. After the 5th attempt, the account is locked.
I have 2 tables for that process, the ‘user’ table where the user information is kept, and the ‘attempts’ table.
First, I don’t want to use a session or cookie variable for the counting of attempts (cookies can be deleted, and session variables can become too much, since it’s a high traffic site); I plan to use an update statement to increase the number by 1.
Here’s where the confusion starts:

First, I’m not sure if I should update the row in the attempt table, or just insert a new row for every attempt (my preference is to insert on the first attempt, and to update the row on the remaining 4 attempts).
Second, I need a way to indicate that the attempt being made today is completely different from the one yesterday. For example, if a user attempted to log in yesterday, and succeeded after the third attempt, and then today, he attempted to login again, I don’t want the attempt to increment yesterday’s attempt. So, in a way, after every successful login, I need a way to ensure that any attempt after a successful login starts a new login process by itself.
I’m not sure if my question is clear. Please, ask for more clarification if needed.
I’ve racked my brain for 2 days without a solution to this process.

Thanks

P.S: I’m using stored procedure for most of the processing to eliminate the traveling back and forth for the processing.

  • 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-27T07:00:01+00:00Added an answer on May 27, 2026 at 7:00 am

    Rather than have a separate table for login attempts, simply add a counter as a new integer column on the user table. Each time a failed attempt is made, increment that column for that record. Each time a successful login is made, reset that column to 0 for that record.

    If you need to keep a running audit of all attempts, that’s a separate concern. Auditing isn’t part of the login process. For that concern you’d write failed attempts to some kind of audit log. This log can be a table in the database, but shouldn’t be linked to the transactional tables in any way. And it can be a general logging system for all kind of application events, not just for failed logins. (Again, another concern entirely.)

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

Sidebar

Related Questions

I have got a strange problem about in_array recently which I cannot understand. e.g.
I have this little problem, that I cannot figure out which arguments to pass
I have a problem which I cant seem to find answer to through searches
I have a simple problem that I cannot seem to find a solution to.
We have a very strange problem which we have yet to be able to
I am having quite a tricky problem, which i just cannot seem to solve.
I have a small problem that I cannot seem to wrap my head around
I am having an annoying problem that I cannot seem to fix. I have
I have a problem which requires me to parse several log files from a
I have a problem which I think is related to forward declarations, but perhaps

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.