title: using exec(); in PHP with variables
body: <p>I'm trying to execute a command on a local Debian server. The code is as following;</p>
  
  <pre><code>if (isset($INPUTdifference)) {
  
  
      $counter = count($INPUTdifference);
      for ($i = 0; $i &lt; $counter; $i++) {
  
          $pkts = $INPUTdifference[$i]["pkts"];
          $bytes = $INPUTdifference[$i]["bytes"];
          $target = $INPUTdifference[$i]["target"];     // = -j 
          $prot = $INPUTdifference[$i]["prot"];        // = -p
          $opt = $INPUTdifference[$i]["opt"];
          $in = $INPUTdifference[$i]["in"];            // = -i
          $out = $INPUTdifference[$i]["out"];         // = -o
          $source = $INPUTdifference[$i]["source"];   // = -s
          $destination = $INPUTdifference[$i]["destination"]; // -d
          //Filter results
  
          $badOpt;
          if (strcmp($opt, $badOpt)) {
              $opt = "all";
              return $opt;
          }
  
          // Execute command with parameters acquired from array
          exec("sudo /sbin/iptables -A INPUT -j $target -p $prot -i $in -o $out -s $source -d $destination ");
          echo 'complete yo';
      }
  }
  </code></pre>
  
  <p>As you can see, I'm trying to use values from the Array into my <code>exec</code> call. The values are all tested and get parsed correctly.</p>
  
  <p>I try to execute the command, and it doesn't give me any feedback/results on the server. At first it was cussing about how I didn't get a parameter right, but I fixed that. So it -is- getting executed on the server. That, I guess, narrows it down to the syntax itself... am I missing something here?</p>