I have created HTML and php page which execute the shell script. In the current script I can submit one e-mail address at a time to execute the script. However, I would like to add multiple e-mail address (comma or space separated) from html and execute the script. Also like to send flash message " you requst has been submited" on the html page so that user should not click on submit button multiple times.
html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>remote and upload reports </title>
</head>
<link href="stylesheets/common.css" type="text/css" rel="stylesheet">
<body>
<h1>Remote and upload document report</h1>
<form method="post" action="script2.php">
Enter URL : <br />
<input type="text" name="ENTER_URL" size="35" />
<br />
Enter e-mail address : <br />
<input type="text" name="ENTER_EMAIL" size="35" />
<br />
<input type="submit" value="Submit" />
<br />
</form>
echo " Request submitted successfully";
</body>
</html>
PHP script:
<?php
$ENTER_URL = $_POST['ENTER_URL'];
$ENTER_EMAIL = $_POST['ENTER_EMAIL'];
if (empty($ENTER_URL)|| empty($ENTER_EMAIL)) {
echo "<h2>You must fill in all fields</h2>\n";
die("Click Back to start again.");
}
echo "<h2>The request has been processed and will get the e-mail notification soon</h2>";
echo "<b>You have entered following URL and e-mail address:</b><br><br>";
echo "$ENTER_URL $ENTER_EMAIL";
?>
<?php
// exec("key2.sh \"$ENTER_URL" \"$ENTER_EMAIL");
$output = exec("./key2.sh $ENTER_URL $ENTER_EMAIL");
echo $output;
?>
SHELL script
grep -iRl "$1" /SAE/file/TM/ots/download/ | mailx "$2"