php-doc-en/reference/var/functions/import-request-variables.xml

86 lines
3 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/var.xml, last change in rev 1.34 -->
<refentry id="function.import-request-variables">
<refnamediv>
<refname>import_request_variables</refname>
<refpurpose>Import GET/POST/Cookie variables into the global scope</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>import_request_variables</methodname>
<methodparam><type>string</type><parameter>types</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>prefix</parameter></methodparam>
</methodsynopsis>
<simpara>
Imports GET/POST/Cookie variables into the global scope. It is
useful if you disabled
<link linkend="ini.register-globals">register_globals</link>,
but would like to see some variables in the global scope.
</simpara>
<simpara>
Using the <parameter>types</parameter> parameter, you can
specify, which request variables to import. You can use
'G', 'P' and 'C' characters respectively for GET, POST and
Cookie. These characters are not case sensitive, so you
can also use any combination of 'g', 'p' and 'c'. POST
includes the uploaded file informations. Note, that the
order of the letters matters, as using "gp", the POST
variables will overwrite GET variables with the same
name. Any other other letters than GPC are discarded.
</simpara>
<simpara>
The <parameter>prefix</parameter> parameter is used as a variable
name prefix, prepended before all variable's name imported into the
global scope. So if you have a GET value named "userid", and provide
a prefix "pref_", then you'll get a global variable named
$pref_userid.
</simpara>
<note>
<para>
Although the <parameter>prefix</parameter> argument is
optional, you will get a notice level error, if you
specify no prefix, or specify an empty string as a
prefix. This is a possible security hazard. Notice
level errors are not displayed using the default
error reporting level.
</para>
</note>
<informalexample>
<programlisting role="php">
<![CDATA[
// This will import GET and POST vars
// with an "rvar_" prefix
import_request_variables("gP", "rvar_");
]]>
</programlisting>
</informalexample>
<simpara>
See also <link linkend="ini.register-globals">register_globals</link>
and <link linkend="ini.track-vars">track_vars</link>.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->