| Current File : //var/wcp4/virentac/public_html/file/index.cgi |
#!/usr/local/bin/perl
# ==================================================================
# File manager - enhanced web based file management system
#
# Website : http://gossamer-threads.com/
# Support : http://gossamer-threads.com/scripts/support/
# Revision : $Id: fileman.cgi,v 1.7 2002/05/14 23:44:37 bao Exp $
#
# Copyright (c) 2001 Gossamer Threads Inc. All Rights Reserved.
# Redistribution in part or in whole strictly prohibited. Please
# see LICENSE file for full details.
# ==================================================================
use lib './private/lib';
use strict;
use GT::Base qw/:all/;
use GT::CGI;
use GT::FileMan;
$| = 1;
local $SIG{__DIE__} = \>::FileMan::fatal;
main();
sub main () {
#-------------------------------------------------------------------
# Main process
#
my $fm = GT::FileMan->new(
commands => {
cmd_search => 1,
cmd_replace => 1,
cmd_command => 0,
cmd_upload => 1,
cmd_editor => 1,
cmd_passwd => 1,
cmd_makedir => 1,
cmd_preferences => 1,
cmd_edit => 1,
cmd_download => 1,
cmd_copy => 1,
cmd_delete => 1,
cmd_move => 1,
cmd_chmod => 1,
cmd_tail => 1,
cmd_perl => 1,
cmd_diff => 1,
cmd_tar => 1,
cmd_admin => 0,
}
);
# Set our tmp directory.
$ENV{GT_TMPDIR} = $fm->{cfg}->{'root_path'} . '/private/tmp';
# Check to see if we need to authenticate.
if ($fm->{cfg}->{username} and $fm->{cfg}->{password}) {
my $username = $fm->{in}->cookie('username') || '';
my $encrypted = $fm->{in}->cookie('password') || '';
my $scheme = $fm->{in}->cookie('scheme') || 'fileman';
if ($fm->{cgi}->{login}) {
$username = $fm->{cgi}->{username} || '';
$encrypted = crypt($fm->{cgi}->{password}, $username);
}
if (!$username or ($username ne $fm->{cfg}->{username}) or ($encrypted ne crypt($fm->{cfg}->{password}, $username))) {
my $msg = $fm->{cgi}->{login} ? $GT::FileMan::Commands::LANGUAGE{ERR_LOGIN} : '';
return $fm->page('login_form.html',{ msg => $msg , username => $fm->{cfg}->{username}, scheme => $scheme, html_url => $fm->{cfg}->{html_root_url} });
}
# Logged in ok, save username, password into cookie
elsif ($fm->{cgi}->{login}) {
print $fm->{in}->header (-cookie => [
$fm->{in}->cookie ( -name => 'username', -value => $username, -expires => ''),
$fm->{in}->cookie ( -name => 'password', -value => $encrypted, -expires => ''),
]);
}
}
$fm->process();
}