<?PHP
/************************************************************************/
/* NPDS V : Net Portal Dynamic System .                                 */
/* ===========================                                          */
/*                                                                      */
/* Based on phpmyadmin.net  grabber library                             */
/*                                                                      */
/* This version name NPDS Copyright (c) 2001-2005 by Philippe Brunier   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* This library grabs the names and values of the variables sent or     */
/* posted to a script in the '$HTTP_*_VARS' arrays and sets simple      */
/* globals variables from them and  use the new globals arrays defined  */
/* with php 4.1+                                                        */
/************************************************************************/

if (!defined('NPDS_GRAB_GLOBALS_INCLUDED')) {
    define('NPDS_GRAB_GLOBALS_INCLUDED', 1);

    // Modify the report level off PHP
    // error_reporting(0); : // report NO ERROR
    // error_reporting(E_ERROR | E_WARNING | E_PARSE); // standard ERROR report
    error_reporting(E_ERROR | E_WARNING | E_PARSE);


    if (get_magic_quotes_runtime()==1) {set_magic_quotes_runtime(0);}
    // To prevent SQL Injection when magic_quotes GPC is off
    $magicquotesGPC=get_magic_quotes_gpc();
    function addslashes_GPC(&$arr) {
       if (is_array($arr))
          @addslashes($arr);
       else
          $arr=addslashes($arr);
    }

    // include current charset
    if (file_exists("meta/cur_charset.php"))
       include ("meta/cur_charset.php");

    // include url_protect Bad Words and create the filter function
    if ($editor_mark)
       include ("../modules/include/url_protect.php");
    else
       include ("modules/include/url_protect.php");

    function url_protect($arr,$key) {
       global $bad_uri_content;
       reset($bad_uri_content);

       if (is_array($arr)) {
          @rawurldecode($arr);
       } else {
          $arr=rawurldecode($arr);
       }
       $RQ_tmp=strtolower($arr);
       $RQ_tmp_large=strtolower($key)."=".strtolower($arr);
       while($uri_content=each($bad_uri_content)) {
          $pos=strpos($RQ_tmp,$uri_content[1]);
          $pos_large=strpos($RQ_tmp_large,$uri_content[1]);
          if (($pos!==false) OR ($pos_large!==false)) {
             if (file_exists("meta/meta.php"))
                include ("meta/meta.php");
             echo "<title>NPDS</title></head><body bgcolor=\"white\"><br /><p align=\"center\"><span style=\"font-size: 14px; font-family: Arial; font-weight: bold; color: red;\">";
             echo "Access Denied / Acc&egrave;s Refus&eacute;";
             if (cur_charset=="utf-8") echo" / &#x901A;&#x5165;&#x88AB;&#x5426;&#x8BA4;";
             echo "</span>";
             echo "<br /><br /><span style=\"font-size: 12px; font-family: Arial; font-weight: bold; color: black;\">NPDS - Portal System";
             echo "</span></p></body></html>";
             die();
          }
       }
    }

    // Get values, slash, filter and extract
    if (!empty($_GET)) {
       if (!$magicquotesGPC)
          array_walk($_GET,'addslashes_GPC');
       reset($_GET);
       array_walk($_GET,'url_protect');
       extract($_GET, EXTR_OVERWRITE);
    } else if (!empty($HTTP_GET_VARS)) {
       if (!$magicquotesGPC)
          array_walk($HTTP_GET_VARS,'addslashes_GPC');
       reset($HTTP_GET_VARS);
       array_walk($HTTP_GET_VARS,'url_protect');
       extract($HTTP_GET_VARS, EXTR_OVERWRITE);
    }

    if (!empty($_POST)) {
       if (!$magicquotesGPC)
          array_walk($_POST,'addslashes_GPC');
       reset($_POST);
//       array_walk($_POST,'url_protect');
       extract($_POST, EXTR_OVERWRITE);
    } else if (!empty($HTTP_POST_VARS)) {
       if (!$magicquotesGPC)
          array_walk($HTTP_POST_VARS,'addslashes_GPC');
       reset($HTTP_POST_VARS);
//       array_walk($HTTP_POST_VARS,'url_protect');
       extract($HTTP_POST_VARS, EXTR_OVERWRITE);
    }

    if (!empty($_COOKIE)) {
       if (!$magicquotesGPC)
          array_walk($_COOKIE,'addslashes_GPC');
       reset($_COOKIE);
       array_walk($_COOKIE,'url_protect');
       extract($_COOKIE, EXTR_OVERWRITE);
    } else if (!empty($HTTP_COOKIE_VARS)) {
       if (!$magicquotesGPC)
          array_walk($HTTP_COOKIE_VARS,'addslashes_GPC');
       reset($HTTP_COOKIE_VARS);
       array_walk($HTTP_COOKIE_VARS,'url_protect');
       extract($HTTP_COOKIE_VARS, EXTR_OVERWRITE);
    }

    if (!empty($_SERVER)) {
       extract($_SERVER, EXTR_OVERWRITE);
    } else if (!empty($HTTP_SERVER_VARS)) {
       extract($HTTP_SERVER_VARS, EXTR_OVERWRITE);
    }

    if (!empty($_ENV)) {
       extract($_ENV, EXTR_OVERWRITE);
    } else if (!empty($HTTP_ENV_VARS)) {
       extract($HTTP_ENV_VARS, EXTR_OVERWRITE);
    }

    if (!empty($_FILES)) {
       while (list($key,$value)=each($_FILES)) {
          $$key=$value['tmp_name'];
       }
    } else if (!empty($HTTP_POST_FILES)) {
       while (list($key,$value)=each($HTTP_POST_FILES)) {
          $$key=$value['tmp_name'];
      }
    }

    unset($bad_uri_content);
}
?>