CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   Alternative of $_SESSION (http://www.codingforums.com/showthread.php?t=216959)

OpenCode 01-31-2011 06:48 AM

Alternative of $_SESSION
 
Hello everybody,

I've read may times that 'use $_SESSION as little as possible'.

While checking WordPress codes I could barely find $_SESSION used
and I do believe big sites won't use $_SESSION or uses too little.

I'm trying to find out the best solution and alternative of $_SESSION.

seeking help

thanks in advance

Lamped 01-31-2011 06:56 AM

The main issues with $_SESSION are:

- Security in shared hosting environments
- The trans-sid feature placing the session ID in the URL

The alternative is $_COOKIE, which is what $_SESSION is kinda based on. The session saves an identifier as a cookie, and uses that to reference a file.

You can solve the security issue by using your own session handlers to read/write data to a database instead of a file.

You can solve the trans-sid issue by... turning it off.

I'd love to hear what issues you've heard of with $_SESSIONs though, as I find most complaints to be unfounded and ridiculous.

OpenCode 01-31-2011 07:05 AM

Hello Lamped,

Quote:

Originally Posted by Lamped (Post 1047507)
The alternative is $_COOKIE, which is what $_SESSION is kinda based on. The session saves an identifier as a cookie, and uses that to reference a file.
...
...
You can solve the trans-sid issue by... turning it off.

Thanks for this information,
is $_COOKIE the best alternative for $_SESSION ?

Quote:

Originally Posted by Lamped (Post 1047507)
You can solve the security issue by using your own session handlers to read/write data to a database instead of a file.

Explain this a little bit more please.


Quote:

Originally Posted by Lamped (Post 1047507)
I'd love to hear what issues you've heard of with $_SESSIONs though, as I find most complaints to be unfounded and ridiculous.

I've heard/read some where in blogs but .. no idea.

Dormilich 01-31-2011 10:02 AM

$_COOKIE is (IMO) not an alternative to $_SESSION, as cookies can be edited by the user at will. to do that with sessions is way harder. besides, session content is not exposed to the outside world (cookies are transferred with every HTTP Request/Response).

your own session handling: see session_set_save_handler()

Lamped 01-31-2011 09:09 PM

Basically, OpenCode...

Just use sessions and don't be so paranoid. Just don't put passwords and credit card info directly into a session and you'll be fine.


All times are GMT +1. The time now is 09:50 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.