View Full Version : Login Check Time In Database
Cologne
10-23-2009, 11:27 AM
Hello,
when I create a login with SA I pick for example username ans password from the database and check it against the formular fields. great, easy works.
Now I got a timecode im my database. how can I check that agains the real time?
I pick the timecode from the database with the lightning button. How can I say...
Login success IF database timecode IS <= actual TIME
Can I use simple >= <?php echo $actualTime; ?>
Cheers
Denis
SOJO web
10-23-2009, 04:20 PM
Denis,
You could work it into the query when authenticating - which would probably be the easiest method.
You would do this by comparing your column's time to CURTIME() or CURDATE(). Those are simple MySQL commands that can be used right in your query as is and will return either the exact Current Time or Current Date... so you simply add a clause to your recordset Select stament making it say WHERE mytime < CURTIME(). Then if no record is returned, you don't allow authentication and create a redirect.
Cheers,
Brian
Cologne
10-23-2009, 11:24 PM
Hi Brian,
do you mean in the wizard? (look the image)
Is it possible to set bigger, smaller and equal?
Cheers
denis
SOJO web
10-24-2009, 11:01 AM
Denis,
I would actually try to make this comparison inside the SQL statement if possible. First, generate everything with the wizard... then go back and hand code the comparison into the SQL using the "WHERE" clause." Then beneath that, you can a conditional PHP logic that states if no record shows up after you created the WHERE clause, then you know that the user doesn't qualify for site entry and then create a redirect.
If you use the wizard and post your code, I can help you about a bit more... I will be in and out the rest of the day but will do what I can.
Cheers,
Brian
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.