#!/usr/bin/perl -w # # $Id: benutzerantrag_ack.pl,v 1.2 1997/06/09 19:58:35 webadm Exp $ # # # DESCRIPTION: benutzerantrag_ack.pl - prints the proposed accounts out and # give the possibility to activate them. # # URL: none yet # # AUTHOR: Cord Beermann (cord@Wunder-Nett.org) # # Thanks to: Ralf Begemann (begemann@cc.fh-lippe.de) # # 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; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # # # A Perl script is "correct" if it gets the job done before your boss fires # you. # ('Programming Perl Second Edition' by Larry Wall, Tom Christiansen # & Randal. L. Schwartz) # # Bugs and shortcomings # none yet # # Todo # * write instructions # ### Configuration ### # # where are the proposed accounts? $DIR='/var/infosystems/www/security/login'; # ### End of Configuration ### # include perl-modules use CGI::Carp; use CGI qw(:standard); use CGI qw(:shortcuts); # initialize the CGI-Module and load the form-input $query = new CGI; $query->autoEscape(undef); # Print out a content-type for HTTP/1.0 compatibility and the HTML-Head print $query->header; print $query->start_html(-"title"=>'Benutzeranträge bestätigen', -"author"=>'gnats@thalassa.cc.fh-lippe.de', -"base"=>'true', -"text"=>'#000000', -"BGCOLOR"=>'#FFFFF7'); print "\n"; print(h1("Benutzeranträge bestätigen"), hr ); # check if we got any accounts to activate if ($query->query_string =~ /=on/) { # loop for each account to activate foreach $name ($query->param) { # if all is right do this: if ($query->param($name) eq 'on') { # move associated file to file.0 rename($DIR . '/' . $name, $DIR . '/' . $name . '.0') or die("rename $DIR/$file $DIR/$file.0: $!\n"); # print an appropriate message print "
Antrag $name weitergeleitet
\n"; } } # add a link to return to the first page print hr, "\n", $query->a({href=>$query->url},'unbestätigete Anträge'); } else { # open Directory and get the contents opendir(LOGINDIR, $DIR) or die "opendir $DIR: $!\n"; @files = readdir LOGINDIR; closedir LOGINDIR; # start the HTML-Form print $query->startform(); # Loop over each directory-content foreach $file (@files) { # skip if the content isn't a file next unless -f $DIR . '/' . $file; # if filename doesn't contain a dot do this unless ($file =~ /\./) { # open the file open(FILE, $DIR . '/' . $file) or warn("can't open $DIR . '/' . $file: $!"); # read the file while ($line =", $query->checkbox(-name=>$file, -label=>$line ) ); last; } close FILE; } } # print a to submit print hr, $query->submit(-name=>'Anmelden'); print $query->endform; } # print HTML-Footer print(hr, address('Autor: ' . a({href=>'http://Cord.de/'}, 'Cord Beermann' ) ), $query->end_html );