**Update** Facebook made updates that fixes this problem.
Troubleshooting: Facebook constantly logs out in Safari
A recent problem has cropped up with the latest version of Safari, 3.2.1 and Leopard 10.5.6. When using Facebook (and possibly other websites such as Last.fm, Gmail, and Twitter, that require authentication to login,) users are finding that they constantly have to re-login again. Of course this gets annoying, and makes accessing those sites nearly impossible. This problem is bad enough that it could even be affecting Firefox users too.
The culprit maybe partially on Facebook’s side as they attempt to combat the recent virus threats and the Leopard/Safari upgrade may be coincidence. Another guess is that Apple changed how multiple programs handle cookies and this is causing issues.
In addition users of iPhones and Adium in conjunction with Facebook seem to have a high chance of having an issue. Using Facebook Chat in Adium and on the iPhone is one of the culprits.
While not a guarantee, here are some possible fixes.
iPhone Users: (may have to be jailbroken to work, I do not have an iPhone to confirm)
1.) Download a terminal program for the iPhone
2.) chown -R mobile /var/mobile/
3.) Power Cycle the iPhone
It seems that the /var/mobile directory is owned by the root user instead of mobile and is causing some of these problems problems.
Safari: One or all of these options may be needed to fix
Advanced Safari Tip: Enable Developer menu using the command line: defaults write com.apple.Safari IncludeDebugMenu 1 or download Safari Enhancer and clear cookies from this menu.
If any of these do work, or you have another solution (or a question about the above,) let me know in the comments and I’ll see what I can do.