9 line function logic problem

From: Date: Sun, 26 Sep 2004 18:00:42 +0000
Subject: 9 line function logic problem
Groups: php.general 
Request: Send a blank email to php-general+get-197880@lists.php.net to get a copy of this message
Hi, I am going crazy with this function please have a look at it and tell me what i am doing wrong. This is my setup: I have a file called one.html.cache in the directory /cache/ in one.html.cache I have a time()+ 3600 number (eg: 1096224755) I need to know if the number in that file is still bigger than the present time() or not the problem is, it is always returning zero... heres the function: echo "b".is_cache("one.html"); function is_cache($get_file) { $th_file = $include_path.$get_file . '.cache'; $fp = fopen($th_file, 'a+'); fseek($fp, 0); $rd = fread($fp, filesize($th_file)); fclose($fp); if (time() - $rd > 5) return 0; else return 1; } What am i doing wrong? or is there a better way of doing this? Thanks, Mag ===== ------ - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo

« previous php.general (#197880) next »