As my headers are already set I can not use the header() function. And for my log out script to work I need to switch page.. Is there anyway to do this?
Cheers
Switch page without using headers?
Moderator: General Moderators
- MindOverBody
- Forum Commoner
- Posts: 96
- Joined: Fri Aug 06, 2010 9:01 pm
- Location: Osijek, Croatia
Re: Switch page without using headers?
You can use ob_start and ob_end_flush functions in your index page. In this case, page will be buffered first, and then outputted. In between of those two functions you can use header function, and "headers already set" message will not happen.
Example:
Also, you can achieve this by editing php.ini file.
Example:
Code: Select all
<?php ob_start(); ?>
Hello World !!!
<?php setcookie("name","value",100); ?>
Again !!!
<?php ob_end_flush(); ?>; Output buffering allows you to send header lines (including cookies) even
; after you send body content, at the price of slowing PHP's output layer a
; bit. You can enable output buffering during runtime by calling the output
; buffering functions. You can also enable output buffering for all files by
; setting this directive to On. If you wish to limit the size of the buffer
; to a certain size - you can use a maximum number of bytes instead of 'On', as
; a value for this directive (e.g., output_buffering=4096).
output_buffering = On
Re: Switch page without using headers?
Perfect, thanks for this.
Dom
Dom