varNames = $varNames; $this->fileName = '__'.basename($_SERVER['SCRIPT_NAME']).'__'.$id; } function load() { if (file_exists($this->fileName)) { $State = unserialize(file_get_contents($this->fileName)); foreach ($State as $varName => $value) { $GLOBALS[$varName] = $value; } return true; } return false; } function save() { $State = array(); foreach ($this->varNames as $varName) { $State[$varName] = @$GLOBALS[$varName]; } if ($f = fopen($this->fileName, 'w')) { fwrite($f, serialize($State)); fclose($f); } } function delete() { unlink($this->fileName); } }