html form to pass variable to php to bash? The Next CEO of Stack OverflowGet the source directory of a Bash script from within the script itselfHow to check if a string contains a substring in BashConvert HTML + CSS to PDF with PHP?How to check if a program exists from a Bash script?How do I tell if a regular file does not exist in Bash?Extract filename and extension in BashHow to check if a variable is set in Bash?Reference — What does this symbol mean in PHP?How to concatenate string variables in BashWhy does HTML think “chucknorris” is a color?

Prepend last line of stdin to entire stdin

Why isn't acceleration always zero whenever velocity is zero, such as the moment a ball bounces off a wall?

Why, when going from special to general relativity, do we just replace partial derivatives with covariant derivatives?

How did people program for Consoles with multiple CPUs?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

Easy to read palindrome checker

Why isn't the Mueller report being released completely and unredacted?

Won the lottery - how do I keep the money?

Is wanting to ask what to write an indication that you need to change your story?

Where do students learn to solve polynomial equations these days?

Is it ever safe to open a suspicious HTML file (e.g. email attachment)?

Does increasing your ability score affect your main stat?

How do I align (1) and (2)?

How to get from Geneva Airport to Metabief?

Running a General Election and the European Elections together

Is there always a complete, orthogonal set of unitary matrices?

What flight has the highest ratio of time difference to flight time?

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

Which one is the true statement?

Powershell. How to parse gci Name?

Why didn't Khan get resurrected in the Genesis Explosion?

Why is quantifier elimination desirable for a given theory?

Recycling old answers

What happened in Rome, when the western empire "fell"?



html form to pass variable to php to bash?



The Next CEO of Stack OverflowGet the source directory of a Bash script from within the script itselfHow to check if a string contains a substring in BashConvert HTML + CSS to PDF with PHP?How to check if a program exists from a Bash script?How do I tell if a regular file does not exist in Bash?Extract filename and extension in BashHow to check if a variable is set in Bash?Reference — What does this symbol mean in PHP?How to concatenate string variables in BashWhy does HTML think “chucknorris” is a color?










0















ok, this is probably more steps than needed.
I have an HTML page that asks for 2 dates (start and end) I want it to accept those dates and send them to a PHP file which will then kick off a script using those dates as variables.



main page:



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Calendar lookup </title>
</head>
<link href="stylesheets/common.css" type="text/css" rel="stylesheet">

<body>

<h1>Calendar Date Range</h1>

<form method="post" action="run_script.php">


Start Date YYYY-MM-DD: <br />
<input type="text" name="Start_Date" size="35" />
<br />

End Date YYYY-MM-DD: <br />
<input type="text" name="End_Date" size="35" />
<br /> <br />

<input type="submit" value="Submit" />
<br />
</form>

</body>


that page should pass the dates to my php file-run_script.php:



<?php


$Start_Date = $_POST['Start_Date'];
$End_Date = $_POST['End_Date'];

exec (sudo sh "gather.sh $Start_Date $End_Date ");
?>


however, it's not kicking off the gather script at all it seems. when I hit the submit button I take me to a blank page /run_script.php and never runs gather.sh (i check where it should be dumping the data nothing shows up)



I know the script works fine if I run sh gather.sh it does what I want just need to get that PHP file to kick it off for the users.



any thoughts? or is this just the completely wrong way to go about it?



Edit



As Ed pointed out it has a giant vulnerability in the PHP. so it is the wrong way.



suggestions on another way are appreciated.










share|improve this question
























  • Should be sudo sh gather.sh "$Start_Date $End_Date"

    – EternalHour
    Mar 21 at 18:13







  • 3





    Please do not deploy this code anywhere; it has a giant injection vulnerability. Anyone able to access the PHP file in a browser could use it to run arbitrary code on your machine.

    – Ed Cottrell♦
    Mar 21 at 18:15







  • 2





    Not to mention there is a php syntax error. PHP has no clue what sudo sh are. You should be passing that into the string "sudo sh gather.sh $Start_Date $End_Date "

    – Derek Pollard
    Mar 21 at 18:23







  • 1





    @stcoyle why not use PHP and something like mysql or plain-text to store dates, then parse them from the plain text file with PHP

    – Derek Pollard
    Mar 21 at 19:28






  • 1





    At the very least you should validate that the values that come are really dates and that are in the range you expect them to be.

    – solarc
    Mar 21 at 19:50















0















ok, this is probably more steps than needed.
I have an HTML page that asks for 2 dates (start and end) I want it to accept those dates and send them to a PHP file which will then kick off a script using those dates as variables.



main page:



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Calendar lookup </title>
</head>
<link href="stylesheets/common.css" type="text/css" rel="stylesheet">

<body>

<h1>Calendar Date Range</h1>

<form method="post" action="run_script.php">


Start Date YYYY-MM-DD: <br />
<input type="text" name="Start_Date" size="35" />
<br />

End Date YYYY-MM-DD: <br />
<input type="text" name="End_Date" size="35" />
<br /> <br />

<input type="submit" value="Submit" />
<br />
</form>

</body>


that page should pass the dates to my php file-run_script.php:



<?php


$Start_Date = $_POST['Start_Date'];
$End_Date = $_POST['End_Date'];

exec (sudo sh "gather.sh $Start_Date $End_Date ");
?>


however, it's not kicking off the gather script at all it seems. when I hit the submit button I take me to a blank page /run_script.php and never runs gather.sh (i check where it should be dumping the data nothing shows up)



I know the script works fine if I run sh gather.sh it does what I want just need to get that PHP file to kick it off for the users.



any thoughts? or is this just the completely wrong way to go about it?



Edit



As Ed pointed out it has a giant vulnerability in the PHP. so it is the wrong way.



suggestions on another way are appreciated.










share|improve this question
























  • Should be sudo sh gather.sh "$Start_Date $End_Date"

    – EternalHour
    Mar 21 at 18:13







  • 3





    Please do not deploy this code anywhere; it has a giant injection vulnerability. Anyone able to access the PHP file in a browser could use it to run arbitrary code on your machine.

    – Ed Cottrell♦
    Mar 21 at 18:15







  • 2





    Not to mention there is a php syntax error. PHP has no clue what sudo sh are. You should be passing that into the string "sudo sh gather.sh $Start_Date $End_Date "

    – Derek Pollard
    Mar 21 at 18:23







  • 1





    @stcoyle why not use PHP and something like mysql or plain-text to store dates, then parse them from the plain text file with PHP

    – Derek Pollard
    Mar 21 at 19:28






  • 1





    At the very least you should validate that the values that come are really dates and that are in the range you expect them to be.

    – solarc
    Mar 21 at 19:50













0












0








0








ok, this is probably more steps than needed.
I have an HTML page that asks for 2 dates (start and end) I want it to accept those dates and send them to a PHP file which will then kick off a script using those dates as variables.



main page:



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Calendar lookup </title>
</head>
<link href="stylesheets/common.css" type="text/css" rel="stylesheet">

<body>

<h1>Calendar Date Range</h1>

<form method="post" action="run_script.php">


Start Date YYYY-MM-DD: <br />
<input type="text" name="Start_Date" size="35" />
<br />

End Date YYYY-MM-DD: <br />
<input type="text" name="End_Date" size="35" />
<br /> <br />

<input type="submit" value="Submit" />
<br />
</form>

</body>


that page should pass the dates to my php file-run_script.php:



<?php


$Start_Date = $_POST['Start_Date'];
$End_Date = $_POST['End_Date'];

exec (sudo sh "gather.sh $Start_Date $End_Date ");
?>


however, it's not kicking off the gather script at all it seems. when I hit the submit button I take me to a blank page /run_script.php and never runs gather.sh (i check where it should be dumping the data nothing shows up)



I know the script works fine if I run sh gather.sh it does what I want just need to get that PHP file to kick it off for the users.



any thoughts? or is this just the completely wrong way to go about it?



Edit



As Ed pointed out it has a giant vulnerability in the PHP. so it is the wrong way.



suggestions on another way are appreciated.










share|improve this question
















ok, this is probably more steps than needed.
I have an HTML page that asks for 2 dates (start and end) I want it to accept those dates and send them to a PHP file which will then kick off a script using those dates as variables.



main page:



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Calendar lookup </title>
</head>
<link href="stylesheets/common.css" type="text/css" rel="stylesheet">

<body>

<h1>Calendar Date Range</h1>

<form method="post" action="run_script.php">


Start Date YYYY-MM-DD: <br />
<input type="text" name="Start_Date" size="35" />
<br />

End Date YYYY-MM-DD: <br />
<input type="text" name="End_Date" size="35" />
<br /> <br />

<input type="submit" value="Submit" />
<br />
</form>

</body>


that page should pass the dates to my php file-run_script.php:



<?php


$Start_Date = $_POST['Start_Date'];
$End_Date = $_POST['End_Date'];

exec (sudo sh "gather.sh $Start_Date $End_Date ");
?>


however, it's not kicking off the gather script at all it seems. when I hit the submit button I take me to a blank page /run_script.php and never runs gather.sh (i check where it should be dumping the data nothing shows up)



I know the script works fine if I run sh gather.sh it does what I want just need to get that PHP file to kick it off for the users.



any thoughts? or is this just the completely wrong way to go about it?



Edit



As Ed pointed out it has a giant vulnerability in the PHP. so it is the wrong way.



suggestions on another way are appreciated.







php html bash






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 21 at 19:48









Tahmid Nishat

36




36










asked Mar 21 at 18:06









stcoylestcoyle

188




188












  • Should be sudo sh gather.sh "$Start_Date $End_Date"

    – EternalHour
    Mar 21 at 18:13







  • 3





    Please do not deploy this code anywhere; it has a giant injection vulnerability. Anyone able to access the PHP file in a browser could use it to run arbitrary code on your machine.

    – Ed Cottrell♦
    Mar 21 at 18:15







  • 2





    Not to mention there is a php syntax error. PHP has no clue what sudo sh are. You should be passing that into the string "sudo sh gather.sh $Start_Date $End_Date "

    – Derek Pollard
    Mar 21 at 18:23







  • 1





    @stcoyle why not use PHP and something like mysql or plain-text to store dates, then parse them from the plain text file with PHP

    – Derek Pollard
    Mar 21 at 19:28






  • 1





    At the very least you should validate that the values that come are really dates and that are in the range you expect them to be.

    – solarc
    Mar 21 at 19:50

















  • Should be sudo sh gather.sh "$Start_Date $End_Date"

    – EternalHour
    Mar 21 at 18:13







  • 3





    Please do not deploy this code anywhere; it has a giant injection vulnerability. Anyone able to access the PHP file in a browser could use it to run arbitrary code on your machine.

    – Ed Cottrell♦
    Mar 21 at 18:15







  • 2





    Not to mention there is a php syntax error. PHP has no clue what sudo sh are. You should be passing that into the string "sudo sh gather.sh $Start_Date $End_Date "

    – Derek Pollard
    Mar 21 at 18:23







  • 1





    @stcoyle why not use PHP and something like mysql or plain-text to store dates, then parse them from the plain text file with PHP

    – Derek Pollard
    Mar 21 at 19:28






  • 1





    At the very least you should validate that the values that come are really dates and that are in the range you expect them to be.

    – solarc
    Mar 21 at 19:50
















Should be sudo sh gather.sh "$Start_Date $End_Date"

– EternalHour
Mar 21 at 18:13






Should be sudo sh gather.sh "$Start_Date $End_Date"

– EternalHour
Mar 21 at 18:13





3




3





Please do not deploy this code anywhere; it has a giant injection vulnerability. Anyone able to access the PHP file in a browser could use it to run arbitrary code on your machine.

– Ed Cottrell♦
Mar 21 at 18:15






Please do not deploy this code anywhere; it has a giant injection vulnerability. Anyone able to access the PHP file in a browser could use it to run arbitrary code on your machine.

– Ed Cottrell♦
Mar 21 at 18:15





2




2





Not to mention there is a php syntax error. PHP has no clue what sudo sh are. You should be passing that into the string "sudo sh gather.sh $Start_Date $End_Date "

– Derek Pollard
Mar 21 at 18:23






Not to mention there is a php syntax error. PHP has no clue what sudo sh are. You should be passing that into the string "sudo sh gather.sh $Start_Date $End_Date "

– Derek Pollard
Mar 21 at 18:23





1




1





@stcoyle why not use PHP and something like mysql or plain-text to store dates, then parse them from the plain text file with PHP

– Derek Pollard
Mar 21 at 19:28





@stcoyle why not use PHP and something like mysql or plain-text to store dates, then parse them from the plain text file with PHP

– Derek Pollard
Mar 21 at 19:28




1




1





At the very least you should validate that the values that come are really dates and that are in the range you expect them to be.

– solarc
Mar 21 at 19:50





At the very least you should validate that the values that come are really dates and that are in the range you expect them to be.

– solarc
Mar 21 at 19:50












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55286679%2fhtml-form-to-pass-variable-to-php-to-bash%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid …


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55286679%2fhtml-form-to-pass-variable-to-php-to-bash%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?