Page 1 of 2

REDIRECT PROBLEM

Posted: Wed Mar 04, 2009 12:49 am
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

Re: REDIRECT PROBLEM

Posted: Wed Mar 04, 2009 11:04 pm
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:

Re: REDIRECT PROBLEM

Posted: Thu Mar 05, 2009 12:19 am
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.....

Re: REDIRECT PROBLEM

Posted: Thu Mar 05, 2009 7:54 pm
by JAB Creations

Code: Select all

<?php
if (isset($_SESSION)) {/*do stuff*/}
?>

Re: REDIRECT PROBLEM

Posted: Thu Mar 05, 2009 8:14 pm
by Benjamin
Where are you calling session_start() from?

Re: REDIRECT PROBLEM

Posted: Tue Mar 10, 2009 5:19 am
by jothirajan
In the common file

Re: REDIRECT PROBLEM

Posted: Tue Mar 10, 2009 6:41 am
by Benjamin
Ok, you need to specify the full path:

Code: Select all

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

Re: REDIRECT PROBLEM

Posted: Tue Mar 10, 2009 9:33 am
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?..

Re: REDIRECT PROBLEM

Posted: Tue Mar 10, 2009 10:29 am
by The Challenger
if($_SESSION['AdminLogin']=="")
use

if(empty($_SESSION['AdminLoging']))

Re: REDIRECT PROBLEM

Posted: Wed Mar 11, 2009 10:32 pm
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

Re: REDIRECT PROBLEM

Posted: Thu Mar 12, 2009 12:52 am
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.

Re: REDIRECT PROBLEM

Posted: Thu Mar 12, 2009 7:12 am
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

Re: REDIRECT PROBLEM

Posted: Thu Mar 12, 2009 7:20 am
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.

Re: REDIRECT PROBLEM

Posted: Thu Mar 12, 2009 9:52 pm
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?..

Re: REDIRECT PROBLEM

Posted: Thu Mar 12, 2009 11:42 pm
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.