Thread:Project:Support desk/cookies error message during connection to wiki/reply

Ehhh, please Do not hack MediaWiki core :) It's really not the best solution, what you are doing. MediaWiki itself should handle session initialization and all other stuff, so i think, that your problem is somewhere in your implementation.

For what i understand, what you want to reach its much better to use the MediaWiki-built in functions. So why not require login for users in order to read/access the content in your wiki?

If you really want to have a pre-login login, then maybe it's better to use .htaccess login, instead of the above code.

Last, but not least, if you really want to have a pre-login form with your own stuff, you should read, how to implement Extensions in MediaWiki. I think it would be much better to use one (or more) of MediaWikis hooks to break in to MediaWiki's page creation process.