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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.