Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session problems

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi I'm using session for user authentication. Originally the following line

<? include('authentication.php'); ?>

is included on each page I would like to protect. If a user accessed directly to a page without logging in, the script will redirect him/her to the appropriate login page. And vice versa the username and password of the user will be registered in session.

Please take a look at the below descriptions


===============Old files=======================
forum.php
download.php
===============================================

===============New files=======================
template.php?section=forum
template.php?section=download
===============================================

When I accessed directly to the file, say forum.php, the script just performed a fine work. But once I've used template.php l
(which is the template engine to construct the entire framework of my site -header,submenu,content,etc.) instead, it gets me errors like


Warning: Cannot send session cookie - headers already sent by (output started at c:\windows\login.php:7) in c:\windows\login.php on line 12

Warning: Cannot send session cache limiter - headers already sent (output started at c:\windows\login.php:7) in c:\windows\login.php on line 12

Could anyone please help me?Thank you very much.

 
post the template php code please. ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
you are starting the session when you already have sent something to the screen.

Session_start MUST be before everything echoed.

See if you have any echo before session_start or even a new line or a blank space before the <?

Correct that, and that error will be gone Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top