php - Running exec in a script -


i have this:

<?php if ($_get['run']) {   # code run if ?run=true set.   exec("./check_sample.sh"); } ?  <!-- link add ?run=true url, myfilename.php?run=true --> <button type="button" onclick="?run=true">click me!</button> 

the shell script check_sample.sh has o/p prints using printf/echo when click 'click me' don't see o/p. anypointer on how make take text input , pass $1 arg. script help

exec() doesn't output anything. use passthru().

be very careful passing user input external program. if make sure escape using escapeshellarg().

kind of this:

passthru('./check_sample.sh '.escapeshellarg($your_user_input)); 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -