[geeklog-devel] CAPTCHA v3.0 removes reliance on PHP sessions

Joe Mucchiello joe at ThrowingDice.com
Sun Jun 3 13:41:03 EDT 2007


I would say it should support nothing but read and write. Though I 
suppose an API could be created. What happens if the value of an 
array member is itself an array? Or if the array have a resource or 
object in it? No, leave it up to the code that wants to save the data 
to know how to save and load it. It is faster for you to code calling 
DB_save in a loop to save the array and to call DB_query with a LIKE 
clause to read the data than it is to write a robust save/load that 
can handle any data structure. Though if I get bored I'll give it a shot.

At a minimum I would probably provide a few helper functions:

function SESS_getSessionVar($name, $default = NULL); // if not in db 
return default do not modify db
function SESS_getAndSetSessionVar($name, $default = NULL); // if not 
in db set value to default and save to db else return db value
function SESS_setSessionVar($name, $value);
function SESS_issetSessionVar($name); // return true if name is in the db
function SESS_unsetSessionVar($name); // delete name from the db
function SESS_clearSessionVars(); // delete all vars associated with 
current session

At 09:31 AM 6/3/2007, Web Site Master wrote:
>This is something that we have needed.
>
>Are you planning for it to be able to handle arrays?  I have an array that
>is built in a plugin each time the user accesses a page.  Building it once
>and storing it for a session would be a lot faster than rebuilding it for
>each access.

----
Joe Mucchiello
Throwing Dice Games
http://www.throwingdice.com 




More information about the geeklog-devel mailing list