ketaki has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use CGI; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use strict; use warnings; use diagnostics; use File::Basename; use CGI::SSI (autotie => 'STDOUT'); print CGI::header(); my $body; my $username="xxxxx"; my $password="xxxxx"; my $step =param('step'); my $user =param('user'); my $pass =param('pass'); my $excelfile =param('excelfile'); if ( (! defined $step) || (($step == 1) && ( ($user ne $username) || ( +$pass ne $password) ) ) ) { if (defined $step) { $body.= "<br><br>Incorrect Username or Password<br><br>" } $body.=<<htmlx; <form action="http://xxxxxxxxxxxxxxxx.org/cgi-bin/update.cgi" meth +od=post> ADMINISTRATOR LOGIN <br><br> Username : <input type=text name="user"> Password : <input type=password name="pass"> <input type=hidden name="step" value=1> <input type=submit value="Login"> </form> htmlx } else { if (($user eq $username) && ($pass eq $password)) { if ($step == 1) { $body.=<<htmlx; <form action="http://xxxxxxxxxxxxx.org/cgi-bin/update.cgi" met +hod=post> Upload excel file <input type=file name="excelfile" chars=40> <input type=hidden name="step" value=2> <input type=hidden name="user" value=$user> <input type=hidden name="pass" value=$pass> <input type=submit value="Submit"> </form> htmlx } # if ($step == 2) # { # my $query = new CGI; # my $upload_dir = "/home/www/xxxxxxxxxxxxxxxxxxx.org/excel"; # my $upload_filehandle = $query->upload("$excelfile"); # # open(EXCELFILE, ">$upload_dir/infosheet.xls"); # chmod("$upload_dir/infosheet.xls",0777); # while ( <$upload_filehandle> ) # { # print EXCELFILE; # } # close(EXCELFILE); # # } } } local $/ = undef; open(file, "/home/www/xxxxxxxxxxxxxxxxxxxxx.org/forcgi.shtml"); my $filedata= <file>; $filedata =~ s/\$body/$body/; close(file); print $filedata;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: software error regarding as described below
by moritz (Cardinal) on Jul 16, 2008 at 13:45 UTC | |
| |
|
Re: software error regarding as described below
by zentara (Cardinal) on Jul 16, 2008 at 13:48 UTC | |
by Fletch (Bishop) on Jul 16, 2008 at 14:23 UTC | |
by zentara (Cardinal) on Jul 16, 2008 at 14:51 UTC |