cvs: phpdoc-zh /faq misc.xml
| From: | Dallas Thunder | Date: | Mon, 15 Aug 2005 15:17:02 +0000 |
| Subject: | cvs: phpdoc-zh /faq misc.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-2281@lists.php.net to get a copy of this message | ||
dallas Mon Aug 15 11:17:02 2005 EDT
Modified files:
/phpdoc-zh/faq misc.xml
Log:
Updated.
http://cvs.php.net/diff.php/phpdoc-zh/faq/misc.xml?r1=1.7&r2=1.8&ty=u
Index: phpdoc-zh/faq/misc.xml
diff -u phpdoc-zh/faq/misc.xml:1.7 phpdoc-zh/faq/misc.xml:1.8
--- phpdoc-zh/faq/misc.xml:1.7 Tue Aug 9 11:47:13 2005
+++ phpdoc-zh/faq/misc.xml Mon Aug 15 11:16:59 2005
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="gb2312"?>
-<!-- $Revision: 1.7 $ -->
+<!-- $Revision: 1.8 $ -->
<!-- $Author: dallas $ -->
-<!-- EN-Revision:1.24 Maintainer: dallas Status: ready -->
+<!-- EN-Revision:1.25 Maintainer: dallas Status: ready -->
<chapter id="faq.misc">
<title>ÔÓÀàÎÊÌâ</title>
<titleabbrev>ÔÓÀàÎÊÌâ</titleabbrev>
<para>
-
ÓÐЩÎÊÌâû·¨¹éµ½ÆäËüÀàÖУ¬Äã¿ÉÒÔÔÚÕâÀï·¢ÏÖËüÃÇ¡£
+ ÓÐЩÎÊÌâû·¨¹éµ½ÆäËüÀàÖУ¬¿ÉÒÔÔÚÕâÀïÕÒµ½¡£
</para>
<qandaset>
@@ -19,7 +19,8 @@
</question>
<answer>
<para>
- Èç¹ûÄãûÓÐÄÜ´¦Àí bz2 ÎļþµÄѹËõ¹¤¾ß£¬´Ó Redhat <ulink
url="&url.bzip2;">ÏÂÔØ</ulink>Ò»¸öÃüÁîÐй¤¾ß£¨½øÒ»²½ÐÅÏ¢¼ûÏÂÃæ£©¡£
+ Èç¹ûÄãûÓÐÄÜ´¦Àí bz2 ÎļþµÄѹËõ¹¤¾ß£¬´Ó Redhat
+ <ulink
url="&url.bzip2;">ÏÂÔØ</ulink>Ò»¸öÃüÁîÐй¤¾ß£¨½øÒ»²½ÐÅÏ¢¼ûÏÂÃæ£©¡£
</para>
<para>
Èç¹ûÄ㲻ϲ»¶ÓÃÃüÁîÐй¤¾ß£¬Äã¿ÉÒÔÊÔÊÔÃâ·Ñ¹¤¾ßÀýÈç
<ulink
@@ -28,7 +29,8 @@
url="&url.7zip;">7-Zip</ulink> »òÕß <ulink
url="&url.quickzip;">Quick Zip</ulink>¡£Èç¹ûÄãÓÐÏñ
<ulink
url="&url.winrar;">WinRAR</ulink> »òÕß <ulink
- url="&url.powerarchiver;">Power Archiver</ulink>
Ö®ÀàµÄ¹¤¾ß£¬¿ÉÒÔºÜÈÝÒ×ÓÃËü½âѹËõ bz2 Îļþ¡£Èç¹ûÄãÓÃ
+ url="&url.powerarchiver;">Power Archiver</ulink>
+ Ö®ÀàµÄ¹¤¾ß£¬¿ÉÒÔºÜÈÝÒ×ÓÃËü½âѹËõ bz2
Îļþ¡£Èç¹ûÄãÓÃ
Total Commander£¨Ç°ÉíΪ Windows Commander£©£¬¿ÉÒÔ´Ó
<ulink url="&url.wincmd;">Total Commander</ulink>
ÍøÕ¾Ãâ·ÑµÃµ½Ò»¸ö bz2 ²å¼þ¡£
</para>
@@ -129,24 +131,43 @@
]]>
</programlisting>
<para>
- ±¾ÀýÄ£Äâ register_globals Off¡£
+ ±¾ÀýÄ£Äâ register_globals
Off¡£Òª¼Çס´Ë´úÂëÓ¦Ôڽű¾×ͷµÄµØ·½µ÷Óá£
</para>
<programlisting role="php">
<![CDATA[
<?php
// Emulate register_globals off
-if (ini_get('register_globals')) {
- $superglobals = array($_SERVER, $_ENV,
- $_FILES, $_COOKIE, $_POST, $_GET);
- if (isset($_SESSION)) {
- array_unshift($superglobals, $_SESSION);
+function unregister_GLOBALS()
+{
+ if (!ini_get('register_globals')) {
+ return;
}
- foreach ($superglobals as $superglobal) {
- foreach ($superglobal as $global => $value) {
- unset($GLOBALS[$global]);
+
+ // Might want to change this perhaps to a nicer error
+ if (isset($_REQUEST['GLOBALS'])) {
+ die('GLOBALS overwrite attempt detected');
+ }
+
+ // Variables that shouldn't be unset
+ $noUnset = array('GLOBALS', '_GET',
+ '_POST', '_COOKIE',
+ '_REQUEST', '_SERVER',
+ '_ENV', '_FILES');
+
+ $input = array_merge($_GET, $_POST,
+ $_COOKIE, $_SERVER,
+ $_ENV, $_FILES,
+ isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
+
+ foreach ($input as $k => $v) {
+ if (!in_array($k, $noUnset) && isset($GLOBALS[$k])) {
+ unset($GLOBALS[$k]);
}
}
}
+
+unregister_GLOBALS();
+
?>
]]>
</programlisting>