#!/usr/bin/perl -w use CGI::Carp qw(fatalsToBrowser); use CGI qw(:standard); use Net::FTP; use Fcntl qw/:flock :DEFAULT/; print "Content-type: text/html\n\n"; $| = 1; if ( $ENV{HTTP_REFERER} =~ 'search' || !param ) { print < Can you say Ch-ch-ch... Chee-Moder?

WebZip© Chee-Moder
Chmod a File or Directory


FTP Site Address
Username   Password
CHMOD Value OR change value to 644, 666, 777, 4711, etc.
Directory/File
Use full path, such as  public_html/mid  or  mid/a-g/always.mid
EOL my $counter = 'chmod_counter.txt'; sysopen(COUNT, $counter, O_RDWR|O_CREAT) or die "Can't OPEN data file for READING and WRITING: $!"; flock(COUNT, LOCK_EX) or die "Cannot get an EXCLUSIVE LOCK on data file: $!"; my $num = || 0; chomp $num; $num++; seek(COUNT, 0, 0) or die "can't REWIND to beginning of data file: $!"; truncate(COUNT, 0) or die "can't TRUNCATE data file: $!"; print COUNT "$num\n"; ## Take out the line below if you don't ## want commas in your numbers. 1 while $num =~ s/(.*\d)(\d\d\d)/$1,$2/; ## Take out the next couple of lines ## down to "close COUNT...", if you ## don't want extensions on the end ## of numbers, such as st, nd, rd, ## or th... as in 2nd or 45th. for($num){s/(1[123]|[4-90])$/$1th/ or s/1$/1st/ or s/2$/2nd/ or s/3$/3rd/}; close COUNT or warn $!; print <
You are the $num person to visit this page
EOL } else { print < Here are your results! EOL $file = param('file'); $site = param('site'); $user = param('user'); $pass = param('pass'); $chmod = param('chmod'); print "

"; # open a connection and log in to FTP site $ftp = Net::FTP->new("$site", passive=>'1', debug=>'5') or print "Cannot CONNECT to Remote Server... $!\n" and exit; print $ftp->message; print "
"; ### LOG IN $ftp->login("$user", "$pass") or print "You have entered the WRONG Username or Password...$!\n" and exit; print $ftp->message; print "
"; if ($file eq "") { print "

ERROR! You must enter the full path of either a file or directory into the \"file\" textbox.

\n"; exit 0; }; $ftp->quot("site chmod $chmod", $file); if ( $ftp->message !~ 'success' ) {print "
ERROR: $file was NOT chmodded. Make sure you filled in the boxes correctly, and that you are using the full path to your file or directory. Also, check your chmod permissions. They must be values 1-7 in all fields, such as 777, 775, 666, or 644. In other words, a CHMOD value of 788 or 799 is incorrect. You may also set the 1st sticky bit value if you know how. That will make chmod use 4 numbers, such as CHMOD value 4755.

\n"; exit } else { print "
$file has been successfully chmodded to $chmod.

You can double-check your new file permissions below.

\n" }; @list = $ftp->dir(); print "
    "; foreach $list(@list) { print "
  1. $list
    \n" } ; print "
"; ### CLOSE CONNECTION $ftp->quit or print "
Cannot CLOSE connection...$!\n
" and exit; print $ftp->message; print ""; };