Reputation: 12190
I'm trying to create very simple page that will look up email address in a logfile
I wrote a bash script (with complex awk and sed queries ) that accepts single argument (email address) and it will display the output as follows.
DATE email phone
31/1/2013 [email protected] 1800-000-000
how can I go about creating a webpage that will only take an email address and a search button that will simply execute the bash script in the backend and display the output to the screen?
Thank you
Upvotes: 0
Views: 2284
Reputation: 538
exec ("/path/to/script", $output);
That will output result into the $output variable.
You can then create page.
<html>
<body>
<form action="index.php">
<input type="text" name="address" />
<input type="submit" value="Post!" />
</form>
</body>
</html>
In the index.php you can put such code:
<?php
if ($_POST && $_POST['address']) {
exec ("/path/to/script " . escapeshellarg($_POST['address']), $output);
echo $output;
}
Upvotes: 1