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 6134119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:18:56+00:00 2026-05-23T17:18:56+00:00

I have a web app which users login to it. Every time a specific

  • 0

I have a web app which users login to it.
Every time a specific user logs in, I store the login datetime in a MySQL db:

(yyyy-mm-dd hh-mm-ss) 

Each record in the db has a user_identifier and last_login_datetime.
However, I want to make sure that users can only login once a day.
I was thinking about comparing the time function in PHP to the datetime I have in the DB and see if the user was already logged on today.
If the user was logged on today, I’ll kick him out.

How do I compare the record in the DB to the time function in PHP to see if the user was logged in already?

Thanks!

  • 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-23T17:18:56+00:00Added an answer on May 23, 2026 at 5:18 pm

    You might add something like this to conditions of the SELECT to validate a user’s credentials when they login

    ... (AND DAY(last_login_datetime) != DAY(NOW()) OR MONTH(last_login_datetime) != MONTH(NOW()) OR YEAR(last_login_datetime) != YEAR(NOW()))
    

    If the day, month, or year do not match today’s day, month, and year, the select will return the user (assuming the other credentials/conditions are valid). If no result is returned, the user’s credentials were incorrect or the user has already logged in today – either way they should not be allowed to login according to your requirements.

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

Sidebar

Related Questions

I have a Silverlight web app which uses ASP.net Website administration tool for user
I have a Flash web app which displays user submitted PNG files. Files are
I have a user profile page on my web app which has contact information.
I have a Mobile App (iPhone and Android) which allows user to login to
We have a non-SSL ASP.NET web app that allows a user to login (ASP
I have a web app which connects to a server using a TCP connection
Have an ASP.net web app which works fine for a few days, but then
I have a LAMP (PHP) web app which need to interface with programs on
The thing I have a web app (asp.net) which needs to have a feed.
I have written a web app in PHP which makes use of Ajax requests

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.