#!/usr/bin/perl -w ## ## muquit, Jun-12-1999 ## generate. :: for upload.pl scritp ## URL: http://www.muquit.com/muquit/software/upload_pl/upload_pl.html ## ## Nov-29-2000, modified for new | separated db file ## ##----------------------------------------------------- use strict; use CGI qw/:standard :html3/;; my $query=new CGI; my $title="generate :: for upload.pl"; ##------ # printHTMLHeader() ##------ sub printHTMLHeader { print $query->start_html( -title=>"$title", -bgcolor=>"#ffffff", -link=>"#000099", -vlink=>"#000099", -alink=>"#ffff00", -text=>"#000000"); } print $query->header; # print the HTML HEADER &printHTMLHeader; # print the HTML HEADER &printHTMLHeader; unless ($query->param) { &printForm; } else { &doWork; } #------------- # print Form #------------- sub printForm { print "
\n"; print<

Helper app for uplaod.pl

This program is for administrator to create the userid, upload directory and Unix crypted password for the upload.pl program. For example, if you enter Userid as foo, upload directory as /usr/local/web/upload/foo and password as foobar, after pressing the Submit button, the output might look like:

foo\|D2t7..SREaGqE\|/usr/local/upload/foo
or
foo\|D2t7..SREaGqE\|c:/upload/foo

You'll cut and paste the line at the end of the upload.db file. EOF ; print "

\n"; print "\n"; print $query->start_form,"\n"; #------------- userid print "\n"; print "\n"; print "\n"; print "\n"; #------------- password print "\n"; print "\n"; print "\n"; print "\n"; #------------- upload directory print "\n"; print "\n"; print "\n"; print "\n"; # submit print "\n"; print "\n"; print "\n"; print $query->end_form,"\n"; print "
\n"; print "Userid:\n"; print "\n"; print $query->textfield(-name=>'userid', -size=>30); print "
\n"; print "Password:\n"; print "\n"; print $query->password_field(-name=>'password', -size=>20); print "
\n"; print "Upload directory:\n"; print "\n"; print $query->textfield(-name=>'upload_dir', -size=>30); print "
\n"; print "
\n"; print $query->submit(-label=>'Submit', -value=>'Submit'),"\n"; print "
\n"; print "
\n"; print "
\n"; } sub doWork { my @saltchars=('a'..'z','A'..'Z','0'..'9',',','/'); my $salt=''; my $crypted_pass=''; my $word=''; my $error=''; my $userid=$query->param('userid'); my $upload_dir=$query->param('upload_dir'); my $password=$query->param('password'); if (! $userid) { $error="No user id supplied
"; } if (! $upload_dir) { $error .= "No upload directory supplied
"; } if (! $password) { $error .= "No password supplied"; } if ($error) { &printForm; &printError($error); return; } if (! $salt) { # random seed srand(time() ^ ($$ + ($$ << 15))); $salt=$saltchars[int(rand(64))]; $salt .= $saltchars[int(rand(64))]; } $crypted_pass=crypt($password,$salt); if ($upload_dir =~ /\\/) { $upload_dir =~ s/\\/\\\\/g; $upload_dir =~ s/\\+/\\\\/g; } &printForm; print "
\n"; print< Please cut and paste the followin the line at the end of upload.db file:
    $userid\|$crypted_pass\|$upload_dir
    
EOF ; } sub printError { my $errmsg=shift; print "
\n"; print "
\n"; print "Error:$errmsg"; print "
\n"; }