Zend - The PHP Company




External

Add Code


Non-broken EscapeShellCmd()  

Type: code fragment
Added by: jribbens
Entered: 03/05/2000
Last modified: 08/12/1999
Rating: - (fewer than 3 votes)
Views: 6048
This is a safe way of passing command-line arguments to child processes.


<?php
function EscapeShellArg($x) {
  return 
"'".ereg_replace("'""\'"$x)."'";
}
?>


Usage Example


exec('/home/user/myprogram '.EscapeShellArg($user_input));


Rate This Script





Search



This Category All Categories