• entries
43
51
• views
32346

# Current Progress

249 views

I've been working on the administration module during the past few days and while working on it I've been really wishing that my host would upgrade to PHP 5. It would be very nice if I could give QueryResult and Database destructors so that I didn't have to remember to call QueryResult::FreeResult() and Database::Disconnect() everytime there is an error. Unfortunately my host probably wont upgrade to PHP 5 for at least a year (my best guess). [headshake]

Anyway, I've implemented a class to help manage the $_SESSION superglobal so that multiple modules can maintain session variables without worrying that another module will overwrite them.  //Helps manage session variables across multiple modules //As with the databases, each variable's name is managed to ensure that it //is unique class SessionManager { //Tests if the variable exists function IsSet($variable, $owner_name) { return isset($_SESSION[this->GetName($variable,$owner_name)]);      }            //Accessor functions      function Get($variable,$owner_name) {         return $_SESSION[this->GetName($variable, $owner_name)]; } //Allows a user to quickly copy variables from an array like$_POST      function SetFromArray($variables,$owner_name) {         foreach ($variables as$key => $value) {$_SESSION[this->GetName[$key,$owner_name]] = $value; } } function Set($variable, $value,$owner_name) {         $_SESSION[this->GetName[$variable, $owner_name]] =$value;      }            //Name mangler      function GetName($variable,$owner_name) {         return $owner_name . '_' .$variable;      }         }

This class might change a bit since I am unsure of the affect of Magic Quotes on $_SESSION. It know that magic quotes will be added but I am unsure what would happen if I did something like this in GetRequestVars() $_SESSION['variable'] = stripslashes($_SESSION['variable']); Will$_SESSION become reslashed when I go to a new file and use the same session? The whole Magic Quotes thing seems to add an unnecessarly layer of complexity.

There are no comments to display.

## Create an account

Register a new account