Web Hosting Talk







View Full Version : PHP sessions and MACs


jtrovato
12-04-2002, 03:31 AM
I have an issue with using sessions on MACs, I have a username/login for a site and one of my clients is using a mac and they can't not log into the system.

It seems to me that the IE on MAC doesn't create sessions??? could this be true. I have tried it on many different MACs and they are all the same..

RackNine
12-04-2002, 04:02 AM
A session is handled server-side and generally not a client issue. Is your problem with the Mac not storing cookies the way your system expects? Rather than deal with cookies compatibility issues across multiple platforms RackNine opted to offer both cookies and a session key passed through links, this way if the cookie didn't work on some sites we have system to fall back on.

Sincerely,

-Matt

jtrovato
12-04-2002, 04:05 AM
I didn't think of that.

you say through the link? as in the URL so the user can see the session ID? There will be alot of data to be sent on certain pages..

ghost
12-05-2002, 08:41 PM
Originally posted by jtrovato
I didn't think of that.

you say through the link? as in the URL so the user can see the session ID? There will be alot of data to be sent on certain pages..

This is the only way if your visitors' browsers don't accept cookies. You have to move your session ID via URL. Or you should push your visitors to open their browsers' cookies part. But personally I advise you to use URL. :)

RackNine
12-14-2002, 07:21 AM
Originally posted by jtrovato
I didn't think of that.

you say through the link? as in the URL so the user can see the session ID? There will be alot of data to be sent on certain pages..
Not true. Create a unique session ID (most people use md5($randomsomethingorother)) and store that ID in a database along with variables you'd like to track about a user. All you then have to pass is the session hash and relate it to your db :)

Sincerely,

-Matt

jtrovato
07-07-2003, 05:48 PM
Thank you!!!

This way who cares if they have cookies enabled

Rich2k
07-07-2003, 06:44 PM
I always force sessions through the URL so it appeals to the majority. However if you do that make sure you take extra protection against session hijacking and session fixation (where someone can force a session id by parsing a link from their site or using cross site scripting).

Although both can still be done with cookie sessions, it seems to be less common.

jtrovato
07-07-2003, 07:40 PM
This is the code I have.


<?
session_start();
echo session_id();
?>


If they have coockies disbaled. Will this work? I guess I could try but I want to make sure that this will work on Both Mac and PC with IE and NS..

jtrovato
07-07-2003, 07:41 PM
cookies.... Sorry lol

garrence
07-07-2003, 08:37 PM
If you compile PHP with --enable-trans-sid (which is always compiled for v4.2.0 onwards) and have
session.use_trans_sid on
in php.ini (it is off by default) then PHP will automatically add the SID to HREFs and as a hidden field on forms.

The downside is that search engines will index less of your site.