#!/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.= "
Incorrect Username or Password
"
}
$body.=<
ADMINISTRATOR LOGIN
Username :
Password :
htmlx
}
else
{
if (($user eq $username) && ($pass eq $password))
{
if ($step == 1)
{
$body.=<
Upload excel file
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= ;
$filedata =~ s/\$body/$body/;
close(file);
print $filedata;