There are three Perl scripts and the third one should operate on data but isn't. 2.pl should create a file /var/ which it doesn't do.
0.pl
1.pl
2.pl
0.pl
Code:
#!/usr/bin/perl
use CGI;
$query = new CGI;
print $query->header;
print $query->start_html(-title=>'Password');
print "<FONT FACE = 'arial' SIZE = '2'>";
print "<FORM ACTION = '/cgi-bin/1.pl' METHOD = 'post'>";
print "<BR>To begin the session, please enter
your Personal Identification Number (PIN) and
password. </B><BR><BR>";
print "<TABLE>
<TR>
<TD><FONT FACE = 'arial' SIZE = '2'> PIN</TD>
<TD><INPUT TYPE='textbox' NAME='pin' SIZE='25' MAXLENGTH='30'></TD>
</TR>
<TR>
<TD><FONT FACE = 'arial' SIZE = '2'> Password</TD>
<TD><INPUT TYPE='password' NAME='password' SIZE='25' MAXLENGTH='30'></TD>
</TR>
</TABLE>";
print "<INPUT TYPE='submit' VALUE='Submit'>";
print "</FORM>";
print $query->end_html;
1.pl
Code:
#!/usr/bin/perl
use CGI;
$query = new CGI;
$pin= $query->param('pin');
$password= $query->param('password');
print $query->header;
print $query->start_html(-title=>'Demo');
print "<FORM ACTION = '/cgi-bin/2.pl' METHOD = 'post'>";
print "<FONT FACE = 'arial' SIZE = '2'>";
print "<B>Enter User Data Here.</B><BR><BR>";
print "User: <INPUT TYPE='textbox' NAME='username' VALUE=''><BR>";
print "UID: <INPUT TYPE='textbox' NAME='uid' MAXLENGTH='8' VALUE=''><BR>";
print "GID: <INPUT TYPE='textbox' NAME='gid' MAXLENGTH='5' VALUE=''><BR><BR>";
print "<INPUT TYPE='hidden' NAME='pin' VALUE=$pin>";
print "<INPUT TYPE='hidden' NAME='password' VALUE=$password>";
print "<INPUT TYPE = 'submit' VALUE = 'Submit Data'>";
print "</FORM></FONT>";
print $query->end_html;
2.pl
Code:
#!/usr/bin/perl
use CGI;
$query = new CGI;
$pin = $query->param('pin');
$password = $query->param('password');
$username = $query->param('username');
$uid = $query->param('uid');
$gid = $query->param('gid');
$filename = "/var/[URL unfurl="true"]www/data/"[/URL] . $username . ".txt";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year=$year+1900;
system("/usr/bin/touch $filename");
system("/sbin/chown $uid:$gid $filename");
print $query->header;
print $query->start_html(-title=>'Save');
print "<FONT FACE = 'arial' SIZE = '2'>";
print "<FORM ACTION = '/cgi-bin/1.pl' METHOD = 'post'>";
print "<INPUT TYPE='hidden' NAME='pin' VALUE=$pin>";
print "<INPUT TYPE='hidden' NAME='password' VALUE=$password>";
print "Thank you.<BR><BR>";
print "<INPUT TYPE='submit' VALUE='Return to menu'>";
print "</FORM>";
print $query->end_html;