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

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현