REDIRECT 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

jothirajan
Forum Commoner
Posts: 69
Joined: Tue Jan 27, 2009 12:06 am

REDIRECT PROBLEM

Post by jothirajan »

Hi all

I am having a problem while i am running in the Firefox and IE browser
============================================================

This is my redirect code ij (index.php)
here i just want the user to login into the site

Code: Select all

 
<?php
if($_SESSION['AdminLogin']=="")
{ 
///check login
}
if(isset($_SESSION['AdminLogin']))
{
/// if already set then redirect him to the controlpanel
header("location:controlpanel.php");
}
?>
 
This above code works for the FIREFOX ,but when i just run this one in the IE it did't redirects the user to the controlpanel.php
I want the login'd user wont go back to the login screen at any more... if he/she gets login into the site....i want them not to go to the index.php
(login page).In that page I checked that isset($_SESSION['AdminLogin']) if SESSION is already set then redirect him to the controlpanel itself...

Works in Firefox not in IE...Please advice how to come out his problem...Sorry for my bad english...

Thanks and Help me
jo
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: REDIRECT PROBLEM

Post by JAB Creations »

jothirajan wrote:This above code works for the FIREFOX ,but when i just run this one in the IE it did't redirects the user to the controlpanel.php
Hmm, looks like you don't want to redirect them to controlpanel.php...you may want to comment out line 10 in your post. :wink:
jothirajan
Forum Commoner
Posts: 69
Joined: Tue Jan 27, 2009 12:06 am

Re: REDIRECT PROBLEM

Post by jothirajan »

JAB Creations wrote:
jothirajan wrote:This above code works for the FIREFOX ,but when i just run this one in the IE it did't redirects the user to the controlpanel.php
Hmm, looks like you don't want to redirect them to controlpanel.php...you may want to comment out line 10 in your post. :wink:

No i want to redirect him if the session is already set...Through AJAX i got the thing i just want to have..but i want to know there is anything there in php...

Even for example ...
if i login into site thru login.php >> success >> profile.php
>> when i just the upper back button in IE it takes me to the login.php
>> if i put the print_r($_Session) in that page (login.php) it wont get the result.But when i refresh the page it outputs the session result...

Any one ..help me.....
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: REDIRECT PROBLEM

Post by JAB Creations »

Code: Select all

<?php
if (isset($_SESSION)) {/*do stuff*/}
?>
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: REDIRECT PROBLEM

Post by Benjamin »

Where are you calling session_start() from?
jothirajan
Forum Commoner
Posts: 69
Joined: Tue Jan 27, 2009 12:06 am

Re: REDIRECT PROBLEM

Post by jothirajan »

In the common file
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: REDIRECT PROBLEM

Post by Benjamin »

Ok, you need to specify the full path:

Code: Select all

 
header("Location: http://mysite.com/controlpanel.php");
 
jothirajan
Forum Commoner
Posts: 69
Joined: Tue Jan 27, 2009 12:06 am

Re: REDIRECT PROBLEM

Post by jothirajan »

astions wrote:Ok, you need to specify the full path:

Code: Select all

 
header("Location: http://mysite.com/controlpanel.php");
 

No i am well known about the header redirection ..... I have tried this too...Not working..

Even if i put

Code: Select all

<?php print_r($_session) //in my login page ?>
I cant able to get my output array ,but if i refresh the page i can able to get the output...

any help?..
The Challenger
Forum Newbie
Posts: 3
Joined: Tue Mar 10, 2009 10:17 am

Re: REDIRECT PROBLEM

Post by The Challenger »

if($_SESSION['AdminLogin']=="")
use

if(empty($_SESSION['AdminLoging']))
jothirajan
Forum Commoner
Posts: 69
Joined: Tue Jan 27, 2009 12:06 am

Re: REDIRECT PROBLEM

Post by jothirajan »

Hello all ...

Thanks for your replies.

I am not good in english. Sorry for that.

I have done all your above said things previously, but we cant ...

For example please try this in IE browser

Have a test.php

Code: Select all

 
<?php
print_r($_Session);
?>
 
Have a test2.php

Code: Select all

 
<?php
print_r($_Session);
?>
 
come to test2.php and then go back using the upper back button in IE browser. You can't get the session result..

Why it is happening?..Yes i am right?.. this is my question

Thanks
Hope i will get the final answer from your side.

Thanks
jo
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: REDIRECT PROBLEM

Post by php_east »

that is browser functionalty you are talking about. that is beyond your control. ( or anyones control for that matter, lol ).

if it works on FF but not IE why should you be looking at your codes in this case ?
if for CSS maybe, we would want similar looking pages, but for other matters, i have serious doubts.

do we have to make separate php codes browser dependent ? ouch, that would be a real pain.
jothirajan
Forum Commoner
Posts: 69
Joined: Tue Jan 27, 2009 12:06 am

Re: REDIRECT PROBLEM

Post by jothirajan »

php_east wrote:that is browser functionalty you are talking about. that is beyond your control. ( or anyones control for that matter, lol ).

if it works on FF but not IE why should you be looking at your codes in this case ?
if for CSS maybe, we would want similar looking pages, but for other matters, i have serious doubts.

do we have to make separate php codes browser dependent ? ouch, that would be a real pain.

Thanks for getting a point browser problem... this IE did't get the session values when the back button is clicked.

May be due to the Cache problem?...Any idea ?..please advice
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: REDIRECT PROBLEM

Post by php_east »

no, you do not undertsand what i am saying. let me reword it for you.

you cannot do anyting about it. you cannot solve it.
it is not *your* problem, it is IE problem.

it is by design. all broswers in using the IE engine behaves the same way.
IE sees this as a security feature probably.
jothirajan
Forum Commoner
Posts: 69
Joined: Tue Jan 27, 2009 12:06 am

Re: REDIRECT PROBLEM

Post by jothirajan »

php_east wrote:no, you do not undertsand what i am saying. let me reword it for you.

you cannot do anyting about it. you cannot solve it.
it is not *your* problem, it is IE problem.

it is by design. all broswers in using the IE engine behaves the same way.
IE sees this as a security feature probably.

Oh .Thanks a lot ...Thanks for giving me a final answer.
But the yahoo , gmail back option is working...How they are doing?..
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: REDIRECT PROBLEM

Post by php_east »

jothirajan wrote: Oh .Thanks a lot ...Thanks for giving me a final answer.
But the yahoo , gmail back option is working...How they are doing?..
they use cookies. it will work if you use cookies as well. session cookies are specially treated, so all browser will handle this correctly very likely. still, it is possible IE treats it differently. you need to conduct controlled tests.
Post Reply