Forum Moderators: coopster
I read the date and time values of the match from the database. I then need to validate them. I could use the system clock BUT somebody could simply move the date on their machine to beat the system! Is there any other way to solve this? Thankyou
When the game is played, you need to enter the result in the database via a php page.
I wish to make it so that the result cannot be entered until the date has passed!
So I call 4th feb @ 7pm from the DB and need to validate it to see if the date has passed. If it has then you can enter the result, if not then you cant enter the result.
What do i validate 4th feb 7pm against? If i use the system clock then people could move their clock/date forward and enter the match result!
[nl3.php.net...]
returns the local (server) system date if you dont pass it a string :)
$date_to_compar = date("g:i a Y-m-d", mktime(date("$hour"), date("$minute"), date("$ampm"), date("$month"), date("$day"), date("$year"))); There is an error with the "ampm" part. When i echo $date_to_compar the time is ALWAYS am when it should be pm. Is there an error in my code?
first i set the current date
$today = date("m-d-Y", mktime(date("m"), date("d"), date("Y"))); then i read the date from the DB
$day = $row['day'];
$year = $row['year'];
$hour = $row['hour'];$date_to_compar = date("m-d-Y", mktime(0, 0, 0, $month, $day, $year));
i then validate the date from the DB to the current date
if($today >= $date_to_compar)
{
$played = 'Yes';
} It works great but how do I add a time validation to this?