Hi all, this is my firts message here, ok, my problem is this:
I use a program called "myprogram" to remove users in shell form a black list, the way i use it is typing in shell ./myprogram remove USERNAME
I want to use a form to make it not needing to go in shell everytime i want to remove some user from there, and here starts my problem, i can show the result in text without problem, but i cant make the form execute that command, this is my form code:
form.pl file
and the result shows ok with this code:
result.pl file
But i'm not sure how to make it execute the command, i try changing the last 2 lines to:
but is not working, i'm learning and i hope someone can help me.
Thank you in advanced and sorry for my bad english
Carlos
I use a program called "myprogram" to remove users in shell form a black list, the way i use it is typing in shell ./myprogram remove USERNAME
I want to use a form to make it not needing to go in shell everytime i want to remove some user from there, and here starts my problem, i can show the result in text without problem, but i cant make the form execute that command, this is my form code:
form.pl file
Code:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<FORM METHOD='GET' ACTION='result.pl'>";
print "User to remove: <INPUT TYPE='text' NAME='name'>";
print "<INPUT TYPE='SUBMIT' VALUE='REMOVE'>";
print "</FORM>";
result.pl file
Code:
#!/usr/bin/perl
$my_input = $ENV{QUERY_STRING};
##read(STDIN, $my_input, $ENV{CONTENT_LENGTH});
@fv_pairs = split /\&/ , $my_input;
foreach $pair (@fv_pairs) {
if($pair=~m/([^=]+)=(.*)/) {
$field = $1;
$value = $2;
$value =~ s/\+/ /g;
$value =~ s/%([\dA-Fa-f]{2})/pack("C", hex($1))/eg;
$INPUT{$field}=$value;
}
}
print "Content-type: text/plain\n\n";
print "./myprogram remove $INPUT{name}";
Code:
system("/path/to/my/program/myprogram remove $INPUT{name}");
but is not working, i'm learning and i hope someone can help me.
Thank you in advanced and sorry for my bad english
Carlos