Sandeep Kamble Sandeep Kamble - 5 months ago 11x
PHP Question

Header() is not redirecting PHP

I am using following PHP code to check session. But if the session is not logged into then page is not redirect just show the black page.

My If condition is right ! it is hitting header function ..
Here is my code:

|| (trim($_SESSION['SESS_MEMBER_ID']) == '')
AND !isset($fb_login)
) {

Suggestions welcome!

HTTP/1.1 200 OK
Date: Wed, 10 Oct 2012 10:57:14 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8


If you're using header("Location: "); after you've output content make sure you've put ob_start(); earlier in the script. ob_start(); buffers your script, so nothing is output until you either call ob_end(); or the end of the file is reached. Calling header("Location: "); after content has already been output to the browser can cause problems.