954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

session varibale is running in IE but not in mozilla firefox

Hi All,

When I was testing my site in mozilla I got the following issue

I am setting session variable in my login1.php file and accessing it in hoa.php file.


this process is working properly in IE but in MOZILLA I am not able to get the value of session. and also not able to read the value set in the child window.

Please help me sort out for this issue.

Thanks.

Regards,

Gagan

gagan22
Junior Poster
131 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

The only time I have had trouble with firefox and $_SESSION has been because it stores the value across multiple tabs (whereas IE doesn't) so I haven't seen your problem before. Can you please post your code for when you store the variable and when you try to access it again?

darkagn
Veteran Poster
1,197 posts since Aug 2007
Reputation Points: 404
Solved Threads: 200
 

Do you possibly have cookies disabled in FF and have php configured to use a cookie to store the session id?

mschroeder
Work Harder
Team Colleague
666 posts since Jul 2008
Reputation Points: 279
Solved Threads: 131
 
The only time I have had trouble with firefox and $_SESSION has been because it stores the value across multiple tabs (whereas IE doesn't) so I haven't seen your problem before. Can you please post your code for when you store the variable and when you try to access it again?

Thanks for reply,
ya sure i will tell u where i am using this.
$loginId=$_REQUEST[user];
$password=$_REQUEST[password];
$_SESSION["userId"]=$loginId;

this is working well on this page in IE and mozilla Firefox
But when i am calling this another page $_SESSION["userId"] in IE this is working well and but not in FireFox.
What is the reason. pls help me. It is very urgent.
Thanks,
Gagan

gagan22
Junior Poster
131 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

Thanks for reply, ya sure i will tell u where i am using this. $loginId=$_REQUEST[user]; $password=$_REQUEST[password]; $_SESSION["userId"]=$loginId;

this is working well on this page in IE and mozilla Firefox But when i am calling this another page $_SESSION["userId"] in IE this is working well and but not in FireFox. What is the reason. pls help me. It is very urgent. Thanks, Gagan


Hi gagan...
once try by using single quotes...

$loginId=$_REQUEST['user'];
$password=$_REQUEST['password'];
$_SESSION[<strong>'</strong>userId<strong>'</strong>]=$loginId;
ahmksssv
Junior Poster in Training
84 posts since Feb 2009
Reputation Points: 11
Solved Threads: 7
 

Hi gagan... once try by using single quotes...

$loginId=$_REQUEST['user'];
$password=$_REQUEST['password'];
$_SESSION[<strong>'</strong>userId<strong>'</strong>]=$loginId;


i have tried this . Still this is not working in mozilla firefox. It is different from IE.
Please help me . How i can sort this problem.

gagan22
Junior Poster
131 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

[QUOTE=gagan22;824742]i have tried this . Still this is not working in mozilla firefox. It is different from IE.
when i am trying to do it . Still it is not working in firefox.
Please help me . How i can sort this problem.

gagan22
Junior Poster
131 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 
The only time I have had trouble with firefox and $_SESSION has been because it stores the value across multiple tabs (whereas IE doesn't) so I haven't seen your problem before. Can you please post your code for when you store the variable and when you try to access it again?

Thanks for reply,
I am sending you URL of my site . then pls check this http://www.warddamon.com/login/myindex.php

Open this URL in Firefox and IE both.
login name is scott
and pwd is 1234
then see the difference and then please tell me how i can sort out this problem.

gagan22
Junior Poster
131 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

This problem with sessions comes again and again. I think it was last month I help solve a simular problem. In most cases the cookie required for the session is unable to be stored inside the browser. So in otherwords, are cookies disabled in the browser that disallows sessions. So if it is mozilla firefox that sessions are not working, check that cookies are enabled. Cookies are all enabled then try using the session id in the url. Those two solutions solve most cases although the session id in the url may be a bit ugly. To use the session id in a url the following is an example of doing a link:

<?
echo '<a href="page2.php?' . SID . '">page 2</a>';
?>


Hope that helps.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

gagan how did u solved your session problem?

Shaaa
Newbie Poster
2 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

gagan how did u solved your session issue?

Shaaa
Newbie Poster
2 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 
gagan how did u solved your session issue?


He may take a while since earlier today he was online and might be night time in his timezone. But since I am familiar with this common problem I will ask for you to run these two test pages in the problem browser(s) to see if they work.

index.php

<? session_start();
$_SESSION['var']='test';
echo '<a href="page2.php?' . SID . '">click here to see if session are enabled.</a>';
?>


page2.php

<? session_start();
if (empty($_SESSION['var']) || !isset($_SESSION['var'])) {
echo '<b>Sessions are not enabled with this method.</b>';
} else {
echo 'Sessions work the $_SESSION[\'var\']='.$_SESSION['var'];
}

Edit: I see gagan is now online so he must spend a wider range of hours online than I thought.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

Hi shaa,

yes i have solved this problem.

Actually my problem was in javascript code where you are calling your javascript code change that into php code.

Let me Explain:----Like this code was creating problem in firefox

if ($row1['isAdmin']=="Yes")
{
$_SESSION["login"]="T";
$_SESSION["admin"]="T";
$_SESSION["userId"]=$loginId;
?>

<script type="text/javascript">
<!--
browserName=navigator.appName;
browserVer=parseInt(navigator.appVersion);
if ((browserName=="Netscape" && browserVer>=7.2) || (browserName=="Microsoft Internet Explorer" && browserVer>=5.5) || (browserName=="Opera" && browserVer>=7.1) || (browserName=="Mozilla Firefox" && browserVer>=1))
version="vernew";
else
version="other";
/* Newer browser URL */
if (version=="vernew")
window.location="admin.php?login=T";
/* Other browsers URL */
else
window.location="admin.php?login=T";
//-->
</script>

<?php
}


I change this code into like this:----- if ($row1['isAdmin']=="Yes")
{
$_SESSION["login"]="T";
$_SESSION["admin"]="T";
$_SESSION["userId"]=$loginId;
header('Location:admin.php?login=T');



}


I think if you are facing such problem you should change ur javascript code into your php code.

I think this information will help you.

Thanks,
Gagan

gagan22
Junior Poster
131 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You