Internet Explorer and Sessions

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Internet Explorer and Sessions

Postby KallistaAEnvarou » 03. January 2008 15:54

In Internet Explorer, my cross-site-scripting function ended up producing this warning:

Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively.

I've been having problems with session handling in Internet Explorer but not in any other browser. I'm relying on sessions for the execution of most of my scripts. How do I go about fixing this problem to where I can use the $_SESSION variable everywhere in every browser, including the crappiest of them all?
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California

Postby sari42 » 03. January 2008 21:48

I never had problems with any browser because all the session handling is done on the server (even if cookies are not available you can configure php to work with $_REQUEST vars)!

I always use something like
Code: Select all
<?PHP
session_start();
//--8<--
$_SESSION['foo'] = 'bar';


the other script:
Code: Select all
<?PHP
session_start();

$from_prev = empty($_SESSION['foo']) ? '' : $_SESSION['foo'];
//--8<--

p.s.
you did switch off register_globals and the warnings, didn't you?
sari42
 
Posts: 800
Joined: 27. November 2005 18:28

Postby KallistaAEnvarou » 03. January 2008 22:54

The start of my PHP Script in my index.php file, which I parse everything through with

RewriteEngine On
RewriteRule .* index.php

has session_start() as the second line (the first is <?php).

Also, I did a JavaScript alert for echo 'alert("$_SESSION[access]=' . $_SESSION[access] . '");'

and got $_SESSION[access]=1 in Opera and $_SESSION[access]= in Internet Explorer, on the same page.

Now, I don't know how to turn off warnings or anything, but that still doesn't account for why I can't access my session variables at all in IE. I can access them just fine in Opera. I haven't tested in FireFox yet cuz I'm too tired to right now, though.
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California

Postby KallistaAEnvarou » 05. January 2008 11:31

I still can't figure this out. Can somebody please help me out?

The problem is that, in Internet Explorer, the $_SESSION variable stays only in the one file. When I use <script src="whatever">, I get the alert $_SERVER[access]= in Internet Explorer, but when I echo it directly in the file, even after <script src="whatever">, I get the correct value.
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California

Postby Izzy » 05. January 2008 11:49

Suggestion - Purely PHP issues are best directed at the PHP Forum as you will more than likely attract a quicker and more knowledgeable response than in here.
http://community.apachefriends.org/f/viewforum.php?f=6

A quote from this page if any one objects to asking in English but I see many post in English in the PHP Forum without any complaints:
http://www.apachefriends.org/en/projects.html
Most German people will understand you and will be more or less able to answer in English.
You're absolutely welcome to ask questions or make suggestions! ;)

I hope you had plenty of rest and are not feeling too tired now :)
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby KallistaAEnvarou » 05. January 2008 14:11

Well, I fixed it. APPARENTLY Internet Explorer just LOVES being like, the worst browser ever, so it has decided that, if the localhost domain name you're using doesn't exist, it's not going to store sessions properly. What I have to do is use localhost as my HTTP_HOST, and then it does.

This is just one more reason I abhor Internet Explorer. Thanks anyway.
KallistaAEnvarou
 
Posts: 126
Joined: 02. December 2007 17:33
Location: Cold Cold California


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 49 guests