To start with, i'll say that i'm new to Perl.
I am having a few hassle passing a php argument to my perl script. The argument comes from an square question. right here's an instance and clarification of the code.
This code is used to ship the identification and retrieve the entire name of the person from the database after which ship it to the perl script so the consumer is deleted from a Fortinet https://goo.gl/huVDQW wi-fi gadget.
$id = $POST['param'];
$SQLq = 'delete from users where id = ?';
$q = $db->prepare($SQLq);
$data = $q->fetch();
$username = $data['user_name']; #data-type in phpmyadming : varchar
exec('perl /var/www/xxx/deleteUserWifi.pl'.' '.escapeshellarg($id).' '.escapeshellarg($username),$output);
Here's the code from my perl script
#login info to log on the fortinet device
my $hostname = "192.168.0.2";
my $username = "aaaa";
my $password = "xxxx";
my $userID= $ARGV;
my $userName = $ARGV;
#connection to the FORTINET device
my $ssh = Net::SSH::Perl->new($hostname);
#string to execute
my $cmd = "config vdom \n
edit root \n
config system dhcp server \n
edit 2 \n
config reserved-address \n
delete ". $userID ." \n
config firewall address \n
delete \"" .$userName "\" \n
my($stdout,$stderr,$exit) = $ssh->cmd($cmd);
I haven't any trouble sending my identity and delete the ip reservation of the consumer from the identification sent. For some reason i can't delete the username entry from the device however if i go within the Hypertext Preprocessor code and hard code the username like this it really works flawlessly pleasant:
$username = "test test";
i've tried a forged (string) before sending it however not anything seems to works.
So any idea on how to debug/fix this???