I am developing a website with a login system. If the user logs in successfully, a cookie is set. The code looks a bit like that:
if(!success)
echo "denied";
else
setCookie(x,x,x,x,x);
Now, the problem is that code like this wouldn't work anywhere else than on a local test server (localhost). Now, my question is, are there any standardized ways to work around this? Or does the developer have to write his code so that problems like these don't appear in the first place?
You can use use
ob_start
andob_end_flush
to activate the output buffering for specific code:or you can activate the output buffering for all your pages from the php.ini: