yeah - the mktime function is returning unix style time (seconds since 1970)
which is why only the last few numbers are changing.  I would recommend
letting the database decide who is able to submit... i.e.

select * from database where lastSubmitDate > 'now()- 1 hour' and IP =
'$ipaddress'

if there is a returned record from the database, you know that this person
has made a submission in the last hour.  Otherwise, let them submit again

Obviously, you will need to figure out the sytax for the now() -1 hour part
depending on your database.


-----Original Message-----
From: wade [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 02, 2002 1:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Difference in time


Hello all,

I am fighting a time issue(don't we all). I have a online poll set up. I
need a way to stop a person from submitting more than once an hour. As of
now I have the time .. mktime(
) .. being stored in a database along
with the users IP.

I want to be able to say if 1 hour has passed from the time .. mktime( ) ..
that is stored in the db they can vote once again. This also has to account
that if someone goes to the poll tomorrow at the same time (same
hour) the script knows it's a different hour and different day.

Scenario: I submit to the poll at 12:00 PM, one hour from now will be 1:00
PM and I can submit again. Now lets say it's 12:00 PM the next day. The
database stored time will say 12:00 PM of the day before, It will not let me
submit because it thinks that it has to be at least 1:00 PM before I can
submit again. Which is wrong.

I was trying to use the mktime( ) function but it keeps giving me these
results.(( 1033578795 )) The last few numbers change but the first few (that
as suppose to be the hour) does not change? mktime(int hour, int minute, int
second, int month, int day, int year). How can I use this mktime( ) function
to do what I need it to? Am I going in the wrong direction?

Thank you very much
Wade



--
Should you have any questions, comments or concerns, feel free to call me at
318-338-2033.

Thank you for your time,

Wade Kelley, Design Engineer
================================================
Bayou Internet...(888) 30-BAYOU...http://www.bayou.com Mississippi
Internet...(800) MISSISSIPPI...http://www.mississippi.net
Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com
================================================

Reply via email to