i'm handling my sessions like this:
this all works fine on my mac osx machine -- where dbmopen files are .db -- but on my debian box, dbmopen creates a .dir and .pagsub sessionValidate { $sessionFile = "$systemRoot/sessions/$FORM{sessionID}"; if ( (open FILE, "${sessionFile}.db"){ close FILE; dbmopen %stored, $sessionFile, 0655; %session = %stored; dbmclose %stored; return 1; } else {; return 0; } } sub sessionWrite { do { $sessionID = md5_hex($session{user_email},time(),r +and(100000)); $sessionFile = "$systemRoot/sessions/${sessionID}"; if (open FILE, "${sessionFile}.db"){ close FILE; $valid = 0; } else { $valid = 1; } } until $valid = 1; # not necessary -- chances are 1/10 +00000 that we'll have a session id already, but still... dbmopen %stored, $sessionFile, 0666; %stored = %session; dbmclose %stored; return $sessionID; }
short of writing for both .db and .dir/.pag can a monk enlighten me?
In reply to dbmopen - if db file do this else do that by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |