Page 1 of 1
Session is not available in different browser
Posted: Mon Aug 17, 2009 5:17 pm
by deecee2000
My code:
File1.php
<?php
session_start();
$_SESSION['name'] = 'ABC';
?>
File2.php
<?php
session_start();
if(isset($_SESSION['name'])
{
echo "Session Set";
}
else
{
echo "Session not Set";
}
?>
When I try to run first file "file1.php" and then "file2.php" in Firefox, session value showing correctly at file2.php
But then if I try "file2.php" in IE the session value is not showing there.
How can I fix this issue.
Any help would appreciated.
Thanks in Advance.
Re: Session is not available in different browser
Posted: Mon Aug 17, 2009 6:19 pm
by requinix
You can't copy session values across browsers like that.
Re: Session is not available in different browser
Posted: Mon Aug 17, 2009 6:23 pm
by jackpf
The session id is stored in a cookie. Browsers use their own cookie management.
Re: Session is not available in different browser
Posted: Mon Aug 17, 2009 6:56 pm
by John Cartwright
tasairis wrote:You can't copy session values across browsers like that.
You most certainly can. A quick google for "session hijacking" will prove this wrong.
However, I think the OP misspoke a little. Perhaps he meant to say after repeating the process that worked in FF, the same did not work in IE.
..but as jackpf hinted, do you have cookies enabled in IE?
Re: Session is not available in different browser
Posted: Mon Aug 17, 2009 7:03 pm
by requinix
John Cartwright wrote:tasairis wrote:You can't copy session values across browsers like that.
You most certainly can. A quick google for "session hijacking" will prove this wrong.
I was careful: note the inclusion of "like that"

Re: Session is not available in different browser
Posted: Mon Aug 17, 2009 7:07 pm
by John Cartwright
tasairis wrote:John Cartwright wrote:tasairis wrote:You can't copy session values across browsers like that.
You most certainly can. A quick google for "session hijacking" will prove this wrong.
I was careful: note the inclusion of "like that"

Touché
Re: Session is not available in different browser
Posted: Mon Aug 17, 2009 7:11 pm
by jackpf
What you could do, is if the user is using the same IP address, give them all the session data for that IP address. Although...this would be a major security risk
But I guess it is possible.
Re: Session is not available in different browser
Posted: Mon Aug 17, 2009 7:28 pm
by requinix
jackpf wrote:What you could do, is if the user is using the same IP address, give them all the session data for that IP address. Although...this would be a major security risk
But I guess it is possible.
The problem is those people who are using the same IP. Like people browsing from behind the same router.
The next-best would be to store information in the database (whatever "the database" is) and associate it with a user. The user has to log in to get their settings and information, but it's there.
Re: Session is not available in different browser
Posted: Mon Aug 17, 2009 7:33 pm
by jackpf
Yeah...that's what I meant by being a security risk. Unless the previous user explicitly logged out, the next user of the same IP address will have all their login info.
And yeah...but doesn't that defeat the point of transferring the session?
Surely the only reason you'd want to do this is so that a user doesn't have to log in multiple times in different browsers...