=?iso-8859-1?Q?Chuck_=ABBeyondFusion=BB?=
Guest
Re: PHP Sessions
The session code needs to be placed at the start of the page, above all
else.
You also appear to be missing a session start. That goes first before any
other PHP code at the start of the page.
--
Chuck Joslin
BeyondFusion.com - Your Fusion Community
www.beyondfusion.com
Register domain names at www.awavedomains.com
"Alex Francis" <alex@francisgreenock.co.uk> wrote in message
news:gujpc3$38r1@flsun90netnews01.netobjects.com.. .
> It is a long time since I did any PHP coding but was asked to create a
> site recently using PHP. Naturally I used some code which I know is
> working on another site but I cannot get it to work on my test server
> which is running PHP5. I think the other site is running PHP4. I would be
> grateful if someone can help.
>
> Here is the error message
> Warning: session_register() [function.session-register]: Cannot send
> session cookie - headers already sent by (output started at
> C:\wamp\www\html\confirm_login.php:50) in
> C:\wamp\www\reqfiles\login.req.php on line 60
>
> Warning: session_register() [function.session-register]: Cannot send
> session cache limiter - headers already sent (output started at
> C:\wamp\www\html\confirm_login.php:50) in
> C:\wamp\www\reqfiles\login.req.php on line 60
> logingroup is
>
> he code for this is here, starting at line 57
> if ($logingroup=="administrator")
> {
> // Create a session value
> session_register ('loginID');
> session_register ('logname');
> session_register ('administrator');
>
> // give the sessions a name
> $_SESSION['loginID'] = $loginID;
> $_SESSION['logname'] = $logname;
> $_SESSION['administrator'] = $administrator;
>
> echo ("logingroup is ");
> echo $_SESSION['administrator'];
>
> } elseif ($logingroup=="member")
> {
>
> // Create a session value
> session_register ('loginID');
> session_register ('logname');
> session_register ('member');
>
> // give the sessions a name
> $_SESSION['loginID'] = $loginID;
> $_SESSION['logname'] = $logname;
> $_SESSION['member'] = $member;
>
> echo ("logingroup is ");
> echo $_SESSION['member'];
>
> }
> mysql_close ($link);
> }
> ?>