Why do I get a broken connection when I try to compare SID with a variable (PHP 4)
I have a little function where I am checking whether the SID constant has any value so that I can avoid the annoying little ? in the URL window. I want to append the SID when the cookies are disabled and I don't want to when cookies are enabled. This works fine without checking, except that the annoying little ? appears after the URL in the browser following by nothing.
Here's what I tried PHP Code:
What is the problem here? |
You don't need this hack, the function you want to accomplish
is supposed to be done by php internally. What I don't get is the ? being added to your url, could you ellaborate ? |
No it isn't. It depends on a special PHP.INI directive. If this directive is off, then it won't work.
I know, because before I used this function, the program works properly only with cookies enabled. If cookies aren't enabled then you need to pass the SID through the URL. The point is, I want to check whether the SID constant is present or not. Because when cookies are enabled, then the constant is not present. This leads to an annoying ? in the URL followed by nothing. Whenever I try to check this though, it works not. I found that the actual problem here is nothing to do with what I originally thought but due to when I try to return something like this (nothing to do with the SID): PHP Code:
|
I noticed that I am passing constants to the function above.
as defined by PHP Code:
|
The "book" recommends.
if(IsSet($session_id) .. End |
For my part, I let the session.use_cookies = 1 in php.ini
if I disable coockie in the web browser client, the session identifier (SID) is automatically added in the URL so I don't see where the problem is. |
As I said keefaz, in my local server the PHP.INI value
session.use_trans_sid is set to off. Maybe I'll just avoid the whole function and leave it as it is. |
All times are GMT -5. The time now is 12:11 AM. |