I have a database with one table called TOKENS. It consists of:
e-mail, token, expired_date, password
How do I check to see if a value exists in a database column? I need to check if the token exists. I have tried querying the column "token" and then storing results in an array and checking if it exists in the array. Is this the best method?
Secondly, how can I query that token and check the corresponding expiry_date set? In Excel this would be like a VLOOKUP. Basically I would query the token and return the expiry_date field of that token.
More Info: I am creating a password reset script. Right now the script checks if user exists in database, if so, generates a random token and expiry date and e-mails a reset link with the token appended to it in a query string.
When the user navigates to the reset.php page through their link, first I check if a password is set and if not show the password reset form (basically first visit will always show the form).
When a user clicks "reset" after entering their password, I need to check if the token is valid.