#!/usr/bin/perl ################################################################################ # WAccess Version 1.1 # # Copyright 1999 Frederic TYNDIUK (FTLS) All Rights Reserved. # # E-Mail: tyndiuk@ftls.org Script License: GPL # # Created 05/30/98 Last Modified 12/24/99 # # Scripts Archive at: http://www.ftls.org/cgi/ # ################################################################################ # Function : # # Display Administrative page # # Use : admin.cgi : query login, pass and display member page # # if good login and pasword : # # admin.cgi?login=YourLogin&pass=YourPassword : display admin page # # admin.cgi?login=YourLogin&pass=YourPassword&ac=admin : admin users # # admin.cgi?login=YourLogin&pass=YourPassword&ac=chpass : change password # ################################################################################ ########################## license & copyright header ########################## # # # Copyright (c) 1999 by TYNDIUK Frederic # # # # This program is free software; you can redistribute it and/or # # modify it under the terms of the GNU General Public License as # # published by the Free Software Foundation; either version 2 of # # the License, or (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program in the file 'COPYING'; if not, write to # # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # # Boston, MA 02111-1307, USA, or contact the author: # # # # TYNDIUK Frederic # # # # # ######################## end license & copyright header ######################## ################################################################################ # DO NOT EDIT ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING # ################################################################################ require 'WAccessLib.pl'; &ReadParse(*input); my $login = $input{'login'}; my $password = $input{'pass'}; my $action = $input{'ac'}; if ($input{'BT_Exit'}) { $action = ""; } if ($action eq "admin") { &admin(); } elsif ($action eq "chpass") { &change_password($login, $password, %input); } else { &CheckAdminMember($login, $password, "root", $ADMIN_FILE); } sub admin { my ($name, $pw, $level, $file); print &PrintHeader; if (! &check_password("root",$login, $password)) { print &BadPassword($NAME_TITLE{'common_admin'}); exit; } $action = "admin"; if ($input{'BT_AddUser'}) { print &HTMLHeaderTitle("$NAME_TITLE{'common_admin'}
$NAME_TITLE{'add_user'}"); print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$NAME_HEADTAB{'new_login'} :
$NAME_HEADTAB{'new_pass'} :
$NAME_HEADTAB{'conf_pass'} :
$NAME_HEADTAB{'level'} :$NAME_HEADTAB{'admin'} $NAME_HEADTAB{'member'}
$NAME_HEADTAB{'user_page'} :
\n"; print &HTMLEnd; exit; } if ($input{'BT_Add'}) { if (($input{'NewPass'} eq $input{'ConfPass'}) && ($input{'NewPass'} ne "") && ($input{'NewLogin'} ne "")) { open(PASSWORD, ">>$PASSWORD_FILE") || &Error("Cannot write password file: $PASSWORD_FILE, Error: $!",1); print PASSWORD ("$input{'NewLogin'}\t".CryptPassword($input{'NewPass'})."\t$input{'Mode'}\t$input{'Page'}\n"); close PASSWORD; $NAME_TITLE{'user_added'} =~ s/Value_login/$input{'NewLogin'}/gi; print &ResutPage("$NAME_TITLE{'common_admin'}
$NAME_TITLE{'user_added'}", "", $action, $login, $password); } else { print &ResutPage("$NAME_TITLE{'common_admin'}
$NAME_TITLE{'error'} : $NAME_TITLE{'add_user'}", $HELP_TEXT{'error_adduser'}, $action, $login, $password); } exit; } if ($input{'BT_DelUser'} && ($input{'No'} >= 0)) { open(PASSWORD, "$PASSWORD_FILE") || &Error("Cannot open password file : $PASSWORD_FILE, Error: $!\n",1); @pass = ; close PASSWORD; ($name) = split /\t/, splice(@pass, $input{'No'}, 1); open(PASSWORD, ">$PASSWORD_FILE") || &Error("Cannot write password file: $PASSWORD_FILE, Error: $!",1); print PASSWORD @pass; close PASSWORD; $NAME_TITLE{'user_deleted'} =~ s/Value_new_login/$name/; print &ResutPage("$NAME_TITLE{'common_admin'}
$NAME_TITLE{'user_deleted'}","", $action, $login, $password); exit; } print &HTMLHeaderTitle("$NAME_TITLE{'common_admin'}
$NAME_TITLE{'manage_users'}"); print "
\n"; print "\n"; open(PASSWORD, "$PASSWORD_FILE") || &Error("Cannot open password file: $PASSWORD_FILE, Error: $!",1); @PassFile = ; close(PASSWORD); $cnt = 0; foreach (@PassFile) { if (! /\s*^#/) { ($name, $pw, $level, $file) = split /\t/; print "\n"; } $cnt++; } print "
$NAME_HEADTAB{'name'} $NAME_HEADTAB{'level'} $NAME_HEADTAB{'user_page'}
$name $level $file

\n"; print &HTMLEnd; }