Author Topic: Editing session in infinite loop?  (Read 771 times)

Offline raestlyn

  • Level 29
  • **
  • Posts: 463
  • Reputation: +9/-5
    • View Profile
Editing session in infinite loop?
« on: February 27, 2010, 06:29:16 PM »
Is it possible to modify session outside of infinite loop in PHP? i have been trying to find information about with but I haven't founded anything.


I can send you pics of my cocks if you want reference.


Offline Bryan

  • Level 7
  • *
  • Posts: 32
  • Reputation: +2/-0
    • View Profile
Re: Editing session in infinite loop?
« Reply #1 on: February 28, 2010, 10:17:59 PM »
A session is just a flat file that PHP treats specially.  You could attach a different `session` file to your players/user accounts and modify that as you desire. 

Offline JGadrow

  • Level 35
  • **
  • Posts: 1,133
  • Reputation: +23/-2
    • View Profile
Re: Editing session in infinite loop?
« Reply #2 on: March 01, 2010, 08:26:45 AM »
Strictly speaking, the sessions that Bryan describes above are only the default implementation. You're able to supply your own session handling mechanisms and many people alter them to store the data in the database instead of in flat files. This is for a few reasons:

First, it removes the necessity of opening another resource (come on, you're already opening a database connection in most cases anyways, right?).

Second, it keeps all the data together in a nice, neat way.

Third, it's much easier to make transformations / informed reads against that data from within a database.
Idiocy - Never underestimate the power of stupid people in large groups.


Offline -fedexer-

  • Level 5
  • *
  • Posts: 17
  • Reputation: +0/-0
    • View Profile
Re: Editing session in infinite loop?
« Reply #3 on: March 01, 2010, 12:57:26 PM »
So i guess you would always recommend saving sessions to a MySQL db as opposed to the flatfile original version?

Offline JGadrow

  • Level 35
  • **
  • Posts: 1,133
  • Reputation: +23/-2
    • View Profile
Re: Editing session in infinite loop?
« Reply #4 on: March 01, 2010, 01:17:23 PM »
Not always. In the world of programming, always is a very dangerous word. ;)

However, it is my opinion that database sessions provide many benefits over the standard flat-file storage method in most cases.
Idiocy - Never underestimate the power of stupid people in large groups.


Offline -fedexer-

  • Level 5
  • *
  • Posts: 17
  • Reputation: +0/-0
    • View Profile
Re: Editing session in infinite loop?
« Reply #5 on: March 01, 2010, 04:43:03 PM »
Aye fair enough always is a bad word to use :P generally then  8)

Are these db sessions easy to implement? Resources i have seen on it seem to involve creating new classes to overwrite the existing pho session saving?

Offline JGadrow

  • Level 35
  • **
  • Posts: 1,133
  • Reputation: +23/-2
    • View Profile
Re: Editing session in infinite loop?
« Reply #6 on: March 02, 2010, 08:14:38 AM »
It's easy enough. You either write a class with methods for the various session operations or you write a variety of functions for the same purpose. Then, you use the php session handler functions to say which method (or function) handles which type of session operation.

Oh, and I almost forgot one of the key benefits of defining your own session handler... security! lol Instead of making sure each and every one of your applications are conforming to relevant security standards, you define your own handler to correct some of php's known session vulnerabilities (such as session fixation) and then you can use it knowing you've already taken the proper security precautions.
Idiocy - Never underestimate the power of stupid people in large groups.


Offline Marek

  • Level 17
  • *
  • Posts: 170
  • Reputation: +6/-0
  • XHTML, CSS, JS, PHP and MySQL are my pantheon.
    • View Profile
Re: Editing session in infinite loop?
« Reply #7 on: March 02, 2010, 02:30:45 PM »
To add to what Jim said, the function used for replacing the session handler is session_set_save_handler. You need to supply functions for the following tasks: open, close, write, read, destroy and garbage collect.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal