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

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?

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

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

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[[B]'[/B]userId[B]'[/B]]=$loginId;

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

$loginId=$_REQUEST['user'];
$password=$_REQUEST['password'];
$_SESSION[[B]'[/B]userId[B]'[/B]]=$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.

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.

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.

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.

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.

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

also try this: start to write in your PHP file from the first character
like this:

<?

Not like this:

some spaces or some new lines <?

:-$ strange, but worked for me..
some browsers just couldn't remember session, always starting new ones, while others could..
with this it's working (and I hope will)

Edited 3 Years Ago by lieky

This article has been dead for over six months. Start a new discussion instead.