Jump to content

Redirecting once logged in


sudsy1970

Recommended Posts

Hi all,

 

I have managed to create a working logon/logout script for my website however i am getting the following message when i try to redirect to the page i want

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\Cosford\template.php:63) in C:\xampp\htdocs\Cosford\customer_login.php  on line 40

 

i have heard that this can often be because of whitespace for which i have checked and cannot see.  don't really undersatnd why it is mentioning my template file at all ??

 

Anyone got any ideas please ?

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/206555-redirecting-once-logged-in/
Share on other sites

It's not just whitespace that sends the headers, it's any content.  Your template.php (which is the first thing to be executed since it is included at the top of customer_login.php) contains html which is sent to the browser before the headers are sent.

 

You need to turn on output buffering by including ob_start() as the first thing to happen (ie. before you include template.php).  Read up on ob_start and the other output control functions for a better understanding.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.