Location: PHPKode > scripts > PHP Parameters List > paramlist.class.php
<?php

// ----------------------------------------------------------------------------
//
// paramlist.class.php - PHP Setting List, ver.0.01 (October 1, 2005)
//
// Description:
//   This class allows to keep and restore global parameters (e.g. current
//   language and skin) of PHP application or website.
//
// Author:
//   Vagharshak Tozalakyan <hide@address.com>
//   This module was written by author on his free time.
//
// Warning:
//   This class is non commercial work. It should not have unexpected results.
//   However, if any damage is caused by this class the author can not be
//   responsible. The use of this class is at the risk of the user.
//
// Requirements:
//   PHP >= 4.1.0
//
// ----------------------------------------------------------------------------


class ParamList
{

  var $params = array();
  var $cookie_expired = 0xd2f00;

  function ParamList($init_params, $sess_start = TRUE)
  {
    if ($sess_start)
    {
      session_start();
    }
    if (is_array($init_params))
    {
      $this->params = $init_params;
    }
  }

  function Proceed()
  {
    foreach ($this->params as $key => $value)
    {
      if (isset($_GET[$key]))
      {
        $_SESSION['__sl'][$key] = $_GET[$key];
      }
      elseif (isset($_SESSION['__sl'][$key]))
      {
        $_SESSION['__sl'][$key] = $_SESSION['__sl'][$key];
      }
      elseif (isset($_COOKIE['__sl'][$key]))
      {
        $_SESSION['__sl'][$key] = $_COOKIE['__sl'][$key];
      }
      else
      {
        $_SESSION['__sl'][$key] = $value;
      }
      $this->params[$key] = $_SESSION['__sl'][$key];
      @setcookie("__sl[$key]", $_SESSION['__sl'][$key], time() + $this->cookie_expired);
    }
  }

}

?>
Return current item: PHP Parameters List