Friday, 15 March 2013

session - header('location:index.php') redirects me to index.php after refreshing the page for 2 times -



session - header('location:index.php') redirects me to index.php after refreshing the page for 2 times -

i have php page (index.php) in after verifying username , password session set($_session['expire']) expired , unset after 30 mins (30 mins after pressing login button) , redirect index.php again:

header('location:index.php');

after verifying, menu shown in index page 1 of item contentmanager.php. shown below clicking item connected db , come in contentmanager.php

switch($_request['action']) { case 'contentmanager' : include('model/content.php'); $contents = getcontent($conn); include('view/contentmanager.php'); break; }

in contentmanger.php have:

<?php //if session not unset , expired yet if ( isset($_session['expire']) && ($now<= $_session['expire'])) { ?> sth... <?php } else { //unset session , redirect index.php 1 time again unset($_session['expire']); session_destroy(); header('location:../index.php');} ?>

this works fine, problem after passing 30 mintues have press "contentmanager" 2 times redirect index.php if press 1 time blank page shown. refreshing page sec time redirect login page (index.php) again.

please help me...

its because youre outputting text (probably blank line) before header. in illustration posted output blank line between ?> ,

php session redirect header unset

No comments:

Post a Comment