Hmm. That's odd. It works for me. At first I thought it might be a problem of uploading the file as binary instead of ascii from a windows machine. But then you noted that if you remove the if, everything works fine. Of course, I don't know if that's local or on the server. My suggestion is pretty much to look at the server's error logs. Nothing pops out beyond $timediff not being declined (which shouldn't affect the script's operation) and your declaration of some possibly unneeded variables. In any case, I hope this helps you with your problem.