hello all ..,
i want to make a simple cgi script that takes itis parameters from a text field in a form
first i create the form page that is command.pl
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
print"<html><head><title>User-add Page</title></head>";
print"<body>";
print"<H1>Enter Your userName</H1>";
print"<form method='post' action='webmin.pl'>";
print"name: <input type='text' name='name' size=40>";
print"<br>";
print"<input type='submit' value='Submit'><br>";
print"<br>";
print"<input type='reset' value='Clear'>";
print"<br>";
print"</form>";
print"</body></html>";
second i made the action page (webmin.pl) that the output will be printed in
#!/usr/bin/perl -w
use CGI;
$cgi=new CGI;
print $cgi->header();
print $cgi->body("<p><center><h1> User add page</p><center></h1>"), $c
+gi$
$input = $cgi->param('name');
$name = system "useradd $input";
print "anew user has been added to you system :$name";
print $cgi->end_html();
i tried to run that every thin was fine and the action page printed .....
but when i checked for the user i cannot find him on my system ! .....
and if i want to add apassword option for this script i can make it with the same way ..... by
adding password option in form and point to it in the action script with the same way
system "passwod $input2" ?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.