...

View Full Version : Cookies in index or in new file



Trki
07-21-2012, 12:46 PM
Hellou!

I want set cookie in index file:

when i put it in the first line under body it doesnt work!

I dont know why... it is in first line so there is no output before...

Could help when i would put the whole page in

ob_start();

ob_end_flush();

I tried it but it still didnt work.

?

Or some ideas?

Fou-Lu
07-21-2012, 04:22 PM
When you hit the page that sets cookies, move off of it and check your browser cookies. Does it show them set as there. Also make sure you enable your error reporting:


ini_set('display_errors', 1);
error_reporting(E_ALL);


If you get no errors, and your cookie exists, make sure you have the domain and path set properly within the setcookie call. Otherwise we need to see some code.

Trki
07-21-2012, 10:18 PM
When you hit the page that sets cookies, move off of it and check your browser cookies. Does it show them set as there. Also make sure you enable your error reporting:


ini_set('display_errors', 1);
error_reporting(E_ALL);


If you get no errors, and your cookie exists, make sure you have the domain and path set properly within the setcookie call. Otherwise we need to see some code.

i decided to set them in another page but i am curious if something with 'output bufering like' ob_start() or something like that could somehow help because this mean that the whole page with all headers will be send together or not?

Microsuck
07-22-2012, 02:13 AM
i decided to set them in another page but i am curious if something with 'output bufering like' ob_start() or something like that could somehow help because this mean that the whole page with all headers will be send together or not?

If your issue is related to the headers already sent error, then yes, output buffering is the answer.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum