Ugh. Just spent the last two hours fscking around with Gallery's PHP, to fix a login bug.
I'd already hacked it to make the login prompt display on the main page if the person viewing the site isn't logged in, instead of that annoying popup window.
However, the PHP wasn't properly setting up the Session Variables properly, so the login page wouldn't work unless you a) refreshed the page before logging in, or b) logged in twice in a row.
I spent about 2 hours playing around with the code, the order of checking things, etc, trying to fix it properly.
And then, in a fit of exasperation, I cheated with a hacky hack of hackiness. I knew the page worked if it was refreshed in the browser, so I just had it check to see if the session variable was set, and if it wasn't, refreshed the page at the server level. The user never sees the page refresh with this:
if(!$PHPSESSID) {
header("Location: albums.php");
}
Ya, it's cheap, but it worked, ok?
Modified source (not that you'd want it) can be found here (tgz).
(BTW, this entry was only made so I could use the phrase 'hacky hack of hackiness')

Post a comment
* under no circumstances will your email address be traded for a sack of quarters. No-sirree.