Hi all,
Was wondering whether anyone has any ideas on how to check that the current system date (date and time properties of windows XP) is correct and has not been inadvertently changed.
My worry is that if someone changes the system date, the functions i have written that use date() or now() to check or write values to a table will produce incorrect data.
As an example, when a user logs into the database i have a function that checks previously held details for staff commencement date, holiday entitlement and holiday incremented
In essence this function is used for adding 1 extra day to an employees current holiday entitlement if they have been working for the company for more than 5 years.
So the function reads a staffs commencement date(for only those records that have a value of 'no' for holiday incremented), adds 5 years to it and checks if this new date is less than or equal to date(), If true then i update the values of holiday entitlement to holiday entitlement + 1 and change holiday incremented to 'yes'.
But if this function is performed after the sytem date is inadvertently changed then the results of this function will be incorrect.
I guess that this problem holds for all instances where date() and now() functions are used to write values to tables.
Am i being over-cautious in this thinking, or is there a simple function that exists to ensure that the system date is correct.
Any thoughts would be appreciated.
Dan.
Was wondering whether anyone has any ideas on how to check that the current system date (date and time properties of windows XP) is correct and has not been inadvertently changed.
My worry is that if someone changes the system date, the functions i have written that use date() or now() to check or write values to a table will produce incorrect data.
As an example, when a user logs into the database i have a function that checks previously held details for staff commencement date, holiday entitlement and holiday incremented
In essence this function is used for adding 1 extra day to an employees current holiday entitlement if they have been working for the company for more than 5 years.
So the function reads a staffs commencement date(for only those records that have a value of 'no' for holiday incremented), adds 5 years to it and checks if this new date is less than or equal to date(), If true then i update the values of holiday entitlement to holiday entitlement + 1 and change holiday incremented to 'yes'.
But if this function is performed after the sytem date is inadvertently changed then the results of this function will be incorrect.
I guess that this problem holds for all instances where date() and now() functions are used to write values to tables.
Am i being over-cautious in this thinking, or is there a simple function that exists to ensure that the system date is correct.
Any thoughts would be appreciated.
Dan.