vrana Thu Aug 16 09:57:06 2007 UTC
Modified files: /phpdoc/en/language variables.xml Log: Simplify and secure the example (bug #42176) http://cvs.php.net/viewvc.cgi/phpdoc/en/language/variables.xml?r1=1.95&r2=1.96&diff_format=u Index: phpdoc/en/language/variables.xml diff -u phpdoc/en/language/variables.xml:1.95 phpdoc/en/language/variables.xml:1.96 --- phpdoc/en/language/variables.xml:1.95 Wed Jun 20 22:24:12 2007 +++ phpdoc/en/language/variables.xml Thu Aug 16 09:57:06 2007 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.95 $ --> +<!-- $Revision: 1.96 $ --> <chapter xml:id="language.variables" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> <title>Variables</title> @@ -944,15 +944,13 @@ <programlisting role="php"> <![CDATA[ <?php -if (isset($_POST['action']) && $_POST['action'] == 'submitted') { +if ($_POST) { echo '<pre>'; - print_r($_POST); - echo '<a href="'. $_SERVER['PHP_SELF'] .'">Please try again</a>'; - + echo htmlspecialchars(print_r($_POST, true)); echo '</pre>'; -} else { +} ?> -<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> +<form action="" method="post"> Name: <input type="text" name="personal[name]" /><br /> Email: <input type="text" name="personal[email]" /><br /> Beer: <br /> @@ -961,12 +959,8 @@ <option value="guinness">Guinness</option> <option value="stuttgarter">Stuttgarter Schwabenbräu</option> </select><br /> - <input type="hidden" name="action" value="submitted" /> - <input type="submit" name="submit" value="submit me!" /> + <input type="submit" value="submit me!" /> </form> -<?php -} -?> ]]> </programlisting> </example>