systemofadown
07-28-2004, 09:07 PM
hello. i have a file on my webserver that is modified every time a certain file is accessed with the data and time of the access. every script that in some way modifies that specific file updates it when it is run. now im working on the verification sub that checks whether the file was modified while the user was on a page that allows modification. basically when a page is created that links to the delete script, it is given a hidden input type that contains the date and time, and when the script is run, it compares that hidden value to the file value. for some reason, the code seems to be checking the values as strings rather than integers. the code is as follows:
($year,$mon,$day,$hour,$min,$sec)=split(/-/,$FORM{'mod'});
($myear,$mmon,$mday,$mhour,$mmin,$msec)=split(/-/,$mod);#$mod is read from file
if (($myear=>$year) and ($mmon=>$mon) and ($mday=>$day) and ($mhour=>$hour) and ($mmin=>$min) and ($msec=>$sec)) {
#Raise Error: File was modified
}
i replaced the actual code since it is not necessary to show it. the problem im having is that regardless of the time it seems to raise the error anyways. im am assuming that it is performing a string length comparison vs. comparing their values which is why it still fires when it shouldnt. if anyone knows how i can fix this problem please let me know.
($year,$mon,$day,$hour,$min,$sec)=split(/-/,$FORM{'mod'});
($myear,$mmon,$mday,$mhour,$mmin,$msec)=split(/-/,$mod);#$mod is read from file
if (($myear=>$year) and ($mmon=>$mon) and ($mday=>$day) and ($mhour=>$hour) and ($mmin=>$min) and ($msec=>$sec)) {
#Raise Error: File was modified
}
i replaced the actual code since it is not necessary to show it. the problem im having is that regardless of the time it seems to raise the error anyways. im am assuming that it is performing a string length comparison vs. comparing their values which is why it still fires when it shouldnt. if anyone knows how i can fix this problem please let me know.