redirection problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pradeepa
Forum Newbie
Posts: 7
Joined: Sun Mar 01, 2009 11:33 pm

redirection problem

Post by pradeepa »

Hi friends,

when the session is out iam redirecting my pages to login page.
using this code

if(!isset($_SESSION['userid']))
{
header("Location:login.php");
}

But my problem is iam using iframes
so login form is coming in iframe.
But i want the total page should redirect to login page

can anyone please help me.....
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: redirection problem

Post by papa »

I'd use javascript for that:

You get some answers on Google, search for:
javascript location.replace target
pradeepa
Forum Newbie
Posts: 7
Joined: Sun Mar 01, 2009 11:33 pm

Re: redirection problem

Post by pradeepa »

where i have to call javascript function in onload event?
pradeepa
Forum Newbie
Posts: 7
Joined: Sun Mar 01, 2009 11:33 pm

Re: redirection problem

Post by pradeepa »

function refreshJsLogin(sessionid)
{
if(sessionid == "")
parent.location.href="index.php";
}

i called this function in body onload event it is working fine
Post Reply