Jump to content

Sessions in databases instead of files


Xeoncross

Recommended Posts

 

Ok, I build my $_SESSION's to use a MySQL database instead of flat files because 1) it is more secure and 2) it makes them available from any server than can access the DB. However, as of late I am questioning my choice.

 

First, I have a API file that would run a LOT quicker if I didn't have to load my small DB abstraction layer and connect to the database just to use sessions for quick things like ajax requests.

 

Second, I am trying to use a SWF unloader that ONLY sends $_FILE data and nothing more (sad really, no $_POST/$_GET data or anything!).

 

So to solve the second problem I am trying to use javascript to add the session_id to the URL when the file is sent so I can just grab it from the URL, clean it, then set it as the current ID.

 

<?php
if (isset($_GET['PHPSESSID']) && sanitize_text($_GET['PHPSESSID'])) {
        session_id($_GET['PHPSESSID']);
}
?>

 

I am having trouble getting my idea to work.

So my question is - Am I thinking about this the right way? Is there anything else that might make this easier?

 

Link to comment
https://forums.phpfreaks.com/topic/99892-sessions-in-databases-instead-of-files/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.