<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.exec.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.escapeshellcmd.php',
    1 => 'escapeshellcmd',
    2 => 'Elude i metacaratteri della shell',
  ),
  'up' => 
  array (
    0 => 'ref.exec.php',
    1 => 'Program execution Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.escapeshellarg.php',
    1 => 'escapeshellarg',
  ),
  'next' => 
  array (
    0 => 'function.exec.php',
    1 => 'exec',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/exec/functions/escapeshellcmd.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.escapeshellcmd" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">escapeshellcmd</h1>
    <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">escapeshellcmd</span> &mdash; <span class="dc-title">Elude i metacaratteri della shell</span></p>

   </div>
   <div class="refsect1 unknown-973" id="refsect1-function.escapeshellcmd-unknown-973">
    <h3 class="title">Descrizione</h3>
     <div class="methodsynopsis dc-description">
      <span class="methodname"><strong>escapeshellcmd</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$command</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

    <p class="para rdfs-comment">
     <span class="function"><strong>escapeshellcmd()</strong></span> elude ogni carattere di una stringa che
     potrebbe essere usata per indurre un comando shell ad eseguire comandi
     arbitrari. Questa funzione dovrebbe essere usata per assicurarsi che ogni dato
     che giunga dall&#039;input dell&#039;utente venga neutralizzato prima di essere passato
     a funzioni come <span class="function"><a href="function.exec.php" class="function">exec()</a></span> o
     <span class="function"><a href="function.system.php" class="function">system()</a></span> o all&#039;<a href="language.operators.execution.php" class="link">operatore backtick
     </a>. Un modello d&#039;utilizzo potrebbe essere:</p>
    <p class="para">
     <div class="informalexample">
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$e </span><span style="color: #007700">= </span><span style="color: #0000BB">escapeshellcmd</span><span style="color: #007700">(</span><span style="color: #0000BB">$userinput</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// qui non ci preoccupiamo se $e contiene spazi<br /></span><span style="color: #0000BB">system</span><span style="color: #007700">(</span><span style="color: #DD0000">"echo </span><span style="color: #0000BB">$e</span><span style="color: #DD0000">"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$f </span><span style="color: #007700">= </span><span style="color: #0000BB">escapeshellcmd</span><span style="color: #007700">(</span><span style="color: #0000BB">$filename</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// e qui lo facciamo, usando le virgolette<br /></span><span style="color: #0000BB">system</span><span style="color: #007700">(</span><span style="color: #DD0000">"touch \"/tmp/</span><span style="color: #0000BB">$f</span><span style="color: #DD0000">\"; ls -l \"/tmp/</span><span style="color: #0000BB">$f</span><span style="color: #DD0000">\""</span><span style="color: #007700">); <br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
      </div>

     </div>
    </p>
    <p class="para">
     Vedere anche <span class="function"><a href="function.escapeshellarg.php" class="function">escapeshellarg()</a></span>, <span class="function"><a href="function.exec.php" class="function">exec()</a></span>, 
     <span class="function"><a href="function.popen.php" class="function">popen()</a></span>, <span class="function"><a href="function.system.php" class="function">system()</a></span> e <a href="language.operators.execution.php" class="link">l&#039;operatore backtick</a>.
    </p>

   </div>

  </div><?php manual_footer($setup); ?>