• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

PHP Sessions and Netscape not working

I'm having the worst time trying to get PHP Sessions to work in Netscape. The variables are just not being carried over to subsequent pages.

My goal is to use sessions once a user has logged in to a site. The following simple test code works fine in IE 5.5, but neither NS 4.7 nor 6. If I can get this to work, the rest is no problem.

---top of page (test1.php)----
<?
session_start();
$SID=session_id();
$ipaddr=$REMOTE_ADDR;
session_register("SID");
session_register("ipaddr");
?>
<html>
<head>
     <title>Sessions Test</title>
</head>
<body>
<a href="test2.php">click here (test2.php)</a>
</body>
</html>
---bottom of page (test1.php)----

---top of page (test2.php)----
<?
session_start();
?>
<html>
<head></head>
<body>
<p>SID = <? echo $SID; ?></p>
<p>ipaddr = <? echo $ipaddr; ?></p>
</body>
</html>
---bottom of page (test2.php)----

So what in the heck am I missing (other than some pulled hair)? Thanks in advance for all your help.
0
tdsoft
Asked:
tdsoft
  • 14
  • 10
1 Solution
 
a.marshCommented:
Take a look in your php.ini file and tell us the settings for each of the following:

track_vars

register_globals

Was PHP compiled with "--enable-trans-sid"?

:o)

Ant
0
 
a.marshCommented:
If "--enable-trans-sid" was not used then change your code from:

<a href="test2.php">click here (test2.php)</a>

to:

<a href="test2.php<?=SID?>">click here (test2.php)</a>


Ant
0
 
tdsoftAuthor Commented:
Hi there,

track_vars is ON

I'm running on a system where I do not have root access, so can not take a direct look at the php.ini file. However, when running phpinfo() in a page, I do not even see a reference to register_globals.

The session id needs to be transparent, so including it in the URL is not an option. Is there any reason that it would work under IE but not NS?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
a.marshCommented:
Sessions work in a number of ways - one is cookies and another is by passing an ID with the URL.

Is Netscape set to accept cookies?

Ant
0
 
tdsoftAuthor Commented:
Yep, sure is. And I've tried this on multiple computers, using different ISPs too. Bizarre, huh?
0
 
a.marshCommented:
Instead of:

<? echo $ipaddr; ?>

try using:

<? echo $HTTP_SESSION_VAR["ipaddr"]; ?>


Ant
0
 
tdsoftAuthor Commented:
Sorry to say, but still no go.

In looking through the phpinfo() display, I noticed towards the bottom a section labeled 'PHP Variables' which currently contains 2 entries:
PHP_SELF = /alaquote/test1.php
HTTP_COOKIE_VARS["PHPSESSID"] = 54bf660517c9c5c87e01cf1b4648f630

Does that help at all?
0
 
tdsoftAuthor Commented:
Forgot to mention, but <? echo $HTTP_SESSION_VAR["ipaddr"]; ?> didn't even work in IE where my other variables are still working fine.
0
 
a.marshCommented:
Sorry, try:

<? echo $HTTP_SESSION_VARS["ipaddr"]; ?>

Missed off the S.

Ant
0
 
tdsoftAuthor Commented:
Don't be sorry, I'm just very happy to be getting any help at all. Thank you very much.

But, still no go unfortunately.
0
 
a.marshCommented:
It's hard because I have used sessions in PHP and they always work in both browsers fine....

I know you said that attaching the SID is not an option, but could you try it just to see if it works? :o)

Ant
0
 
a.marshCommented:
Is your server internal or is it on the Internet?

Ant
0
 
a.marshCommented:
Something else to try (I'm trying to compare what I always do to what you have done):

session_start();
session_register("SID");
session_register("ipaddr");
$SID=session_id();
$ipaddr=$REMOTE_ADDR;

I always register the variables first and then set them.

Ant
0
 
tdsoftAuthor Commented:
I'll try the URL SID in a minute.
The server is on the Internet.
I've gone both ways regarding the order of registering.
0
 
tdsoftAuthor Commented:
Just tried

<a href="test2.php?SID=<?echo $SID; ?>">click here (test2.php)</a>

and it worked fine in both IE and NS, but that's only to be expected since SID is being declared on test1.php.
0
 
a.marshCommented:
As the server is on the Internet, is there any chance of looking at the output of phpinfo() for the server? Perhaps you can give me a link to a script that calls the function?

It may shed some light...

:o)

Ant
0
 
tdsoftAuthor Commented:
0
 
a.marshCommented:
In test2.php try using:

session_start($SID);

Ant
0
 
a.marshCommented:
Another suggestion - upgrade!!

You are using a beta version of the early version of PHP4 - it is now up to PHP 4.05!!

Ant
0
 
a.marshCommented:
Sory tdsoft, but it is getting late here - I'm off to bed at some point in the next half hour - I can continue with this tomorrow. :o)

Ant
0
 
a.marshCommented:
Here are some interesting "bug" pages I found with regards to PHP4.0B2 (you really need to upgrade!!! You should never use a beta version for "live" sites!):

http://www.php.net/bugs.php?id=2735

http://www.php.net/bugs.php?id=2612

http://www.php.net/bugs.php?id=2228

http://www.php.net/bugs.php?id=2126

Ant
0
 
tdsoftAuthor Commented:
Tell me about it. My ISP is apparently discontinuing upgrades for my line of servers and it looks like I'm going to have to fight to get an upgrade done.

Ordinairily I wouldn't mind, but I'm hosting over 30 domains on this one server and it's going to be a real pain to transfer them to another setup.

I sure appreciate all your help. Enjoy your points.
0
 
tdsoftAuthor Commented:
Worked hard, so enjoy.

Too bad there really was no answer.

Thanks!
0
 
a.marshCommented:
Glad to help - sorry we couldn't get a working solution... but that can be the deal with beta software....

:o\

Thanks for the A grade!

:o)

Ant
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 14
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now