Page 1 of 1

Sessions, cookie header conflicts

Posted: Wed Feb 11, 2004 3:15 am
by harsha
i am using sessions to store the name of the skin for my site the code is some thing like this

session_start();

if(!session_register($_SESSION['Skin'])){
$_SESSION['Skin'] = "Default";
}

and i am using the value of the $_SESSION to include the index.php of the skin folder

include("Skinz/".$_SESSION['Skin']."/index.php");

when i run the script i am getting a waring the
session cookie cannot be balh balh... header already sent

how do i eliminate this warning using ob_start() and related fuction
or is there any possibilty of eliminating this warining with out using ob_start

Posted: Wed Feb 11, 2004 3:17 am
by JayBird
Read this:

viewtopic.php?t=1157

Mark

Posted: Wed Feb 11, 2004 3:18 am
by Dr Evil
Your error is possibly comming from the fact that you sent some info to the browser before your session_start().
Make sure you have no blank lines outside of php tags.

Dr Evil

Posted: Wed Feb 11, 2004 3:28 am
by malcolmboston
as both previous posts stated there cannot be any output to the browser before the script sends its headers

also, whitespace is not allowed

Posted: Wed Feb 11, 2004 4:12 am
by twigletmac
Once you've fixed the header problem you should change:

Code: Select all

if(!session_register($_SESSION['Skin'])){
to

Code: Select all

if (!isset($_SESSION['Skin'])) {
Mac

thanx fixed the session problem

Posted: Wed Feb 11, 2004 4:32 am
by harsha
thank you all it was due to the whitespaces
Wow this is a silly mistake !!!!