
November 13th, 2012, 09:16 PM
|
|
|
|
Executing a binary on server
I am trying to execute a binary on a server from a webpage.
My web page code is as follows:
Code:
<html>
<body>
<form action="" method="post">
<button type="submit" name="button">Turn on Front Porch Light</button>
</form>
<?php
$var1 = "14";
$var2 = "on";
$var3 = "3m";
if (isset($_POST['button'])) { exec("'./www/var/HAI.pl'. '$var1, $var2, $var3"); print($status); }
?>
</body>
</html>
and the server perl script is as follows:
Code:
#!/usr/bin/perl -w
my $var1 = '';
my $var2 = '';
my $var3 = '';
$var1 = $ARGV[0];
$var2 = $ARGV[1];
$var3 = $ARGV[2];
print "VAR1: ".$var1."\n";
print "VAR2: ".$var2."\n";
print "VAR3: ".$var3."\n";
system("/bin/hai", $var1, $var2, $var3);
I am using the Linux Zoneminder CCTV security camera software which provides a web page for viewing the security cameras. What I am trying to do is add buttons to the web page which would allow me to turn exterior floodlights on/off in the vicinity of the cameras.
I can successfully execute the perl script locally at the server and turn the floodlights on/off but I cannot successfully execute it from the web page.
I would greatly appreciate any assistance in getting this mod to work.
|