2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 09:15:58 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xml:id="function.import-request-variables" xmlns="http://docbook.org/ns/docbook">
|
2007-06-02 19:28:01 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>import_request_variables</refname>
|
|
|
|
<refpurpose>Import GET/POST/Cookie variables into the global scope</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
|
|
|
<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>
|
|
|
|
<para>
|
|
|
|
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.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
If you're interested in importing other variables into the global scope,
|
2009-05-04 21:23:55 +00:00
|
|
|
such as <varname>$_SERVER</varname>, consider using <function>extract</function>.
|
2007-06-02 19:28:01 +00:00
|
|
|
</para>
|
2012-07-20 08:55:25 +00:00
|
|
|
&warn.deprecated.function-5-3-0.removed-5-4-0;
|
2007-06-02 19:28:01 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>types</parameter></term>
|
|
|
|
<listitem>
|
2007-06-02 22:05:58 +00:00
|
|
|
<para>
|
2007-06-02 19:28:01 +00:00
|
|
|
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 POST uploaded file information.
|
|
|
|
</para>
|
|
|
|
<note>
|
|
|
|
<para>
|
2009-05-04 21:23:55 +00:00
|
|
|
Note that the order of the letters matters, as when using
|
|
|
|
"<literal>GP</literal>", the
|
2007-06-02 19:28:01 +00:00
|
|
|
POST variables will overwrite GET variables with the same name. Any
|
|
|
|
other letters than GPC are discarded.
|
2007-06-02 22:05:58 +00:00
|
|
|
</para>
|
|
|
|
</note>
|
2007-06-02 19:28:01 +00:00
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>prefix</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Variable name prefix, prepended before all variable's name imported
|
2009-05-04 21:23:55 +00:00
|
|
|
into the global scope. So if you have a GET value named
|
|
|
|
"<literal>userid</literal>", and provide a prefix
|
|
|
|
"<literal>pref_</literal>", then you'll get a global variable named
|
2007-06-02 19:28:01 +00:00
|
|
|
<varname>$pref_userid</varname>.
|
|
|
|
</para>
|
|
|
|
<note>
|
|
|
|
<para>
|
|
|
|
Although the <parameter>prefix</parameter> parameter is optional, you
|
2009-05-04 21:23:55 +00:00
|
|
|
will get an <link linkend="errorfunc.constants.errorlevels.e-notice"><constant>E_NOTICE</constant></link> level
|
2007-06-02 19:28:01 +00:00
|
|
|
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 <link
|
|
|
|
linkend="ini.error-reporting">error reporting</link> level.
|
|
|
|
</para>
|
|
|
|
</note>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
&return.success;
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>import_request_variables</function> example</title>
|
|
|
|
<programlisting role="php">
|
2002-04-15 00:12:54 +00:00
|
|
|
<![CDATA[
|
2003-05-30 16:58:05 +00:00
|
|
|
<?php
|
2002-04-15 00:12:54 +00:00
|
|
|
// This will import GET and POST vars
|
|
|
|
// with an "rvar_" prefix
|
2007-06-02 19:28:01 +00:00
|
|
|
import_request_variables("gp", "rvar_");
|
2002-05-06 01:52:29 +00:00
|
|
|
|
2003-12-15 16:55:22 +00:00
|
|
|
echo $rvar_foo;
|
2003-05-30 16:58:05 +00:00
|
|
|
?>
|
2002-04-15 00:12:54 +00:00
|
|
|
]]>
|
2007-06-02 19:28:01 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<para>
|
|
|
|
<simplelist>
|
2008-08-23 15:40:25 +00:00
|
|
|
<member><varname>$_REQUEST</varname></member>
|
2007-06-02 19:28:01 +00:00
|
|
|
<member><link linkend="ini.register-globals">register_globals</link></member>
|
|
|
|
<member><link linkend="language.variables.predefined">Predefined Variables</link></member>
|
|
|
|
<member><function>extract</function></member>
|
|
|
|
</simplelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- 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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2002-04-15 00:12:54 +00:00
|
|
|
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
|
|
|
|
-->
|