The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Setting a cookie?
Where do I place my setcookie code if I want to set a cookie when someone visits the index page?
I'm having problems with header already being sent errors, so I'm obviously placing my code in the wrong place. Please help! |
#2
|
||||
|
||||
cookies should be set before your server send any other info to the user's browser. So if you start sending ANY INFO, say any text, just a letter, even a space char. etc.) before setting your cookie you'll get this message.
This rules still applies when you have inclusions in your code. So you code might not be sending an info to the user but another script included in it may do so, which will cause the same error. Another frequent mistake is to miss an invisible char somewhere before setcookie command which will again give you the headache (Even if its invisible its a char). So the solution is to set the cookie before sending any other info to the user.. |
#3
|
|||
|
|||
Thanks for your reply. I understand the part about setting the cookie before any output, I just really can't figure out where the setcookie code should be inserted. I've tried many different files but I still get the error. What file and line should it be inserted on?
Thanks! |
#4
|
||||
|
||||
himm.. I thought you know the basics of cookie setting so didnt think you are asking the file name..
Well, for your site's main page, it's index.php and you can use the very top of the file to enter your cookie command. But considering the fact that you dont know which file you should use, I doubt if you can handle setting a cookie within this file. If you plan to copy/paste from vb file, it wouldnt work as you expected.. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|