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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:22:21+00:00 2026-06-10T18:22:21+00:00

I am writing password recovery code that uses a token and a date stored

  • 0

I am writing password recovery code that uses a token and a date stored in date("Y-m-d H:i:s") format e.g. 2012-09-06 18:59:53. I use the code below to check if the token key for a user id exists:

$sql = mysql_query("SELECT * FROM `recoveryemails` WHERE `UserID` = '$uid' and `Key` = '$key' and `expDate` >= '$curDate'");

I need to add another condition after retrieving the expDate to check whether it’s older than 3 days, using PHP. Can anyone help me out with that PHP code?

  • 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-06-10T18:22:22+00:00Added an answer on June 10, 2026 at 6:22 pm

    It’s a lot easier in MySQL: WHERE ... AND expdate >= DATE_SUB(NOW(),INTERVAL 3 DAY)

    But if you insist on doing it in PHP, you will need:

    $threedaysago = strtotime("-3 days");
    $expdate = strtotime($row['expDate']);
    if( $expdate >= $threedaysago) { /* more recent than three days ago */ }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing a jquery function to check whether password user enters is already in use.
I am having trouble writing a stored procedure that first checks a hashed password
I'm writing a batch file that runs the below command winscp sftp://username:password@host.com:22 /privatekey=pgp530.ppk The
Writing documentation in html requires some code examples. What to do with characters that
i'm thinking about writing a WPF program that would require login and password at
I'm writing a C# frontend to a legacy database that uses VB6 Rnd() and
I am writing a software that grabs a password using std::cin However unlikely, i
Im writing a client/server app for android that sends a username and password to
I am writing an application that needs to read a user name and password
I'm writing a bash script that will receive a password via STDIN and go

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.