#!/usr/bin/perl ############################## # gBasic Programming - gigasoft2@webtv.net # # Script : Chmodder # Version : n/a # # Description : # Change the permissions of a file. # # Requirements : CGI module # # Variables : # # $disable # Set to 1 to disable script, so noone can use it. # Set to 0 to enable script again. # # Policy : # You may use this program free of charge as long as # the comments and credit remain intact. ############################## use CGI qw(param); $filech = param("filetochmod"); $chnum = param("chmodnumber"); $disable = 0; $faction = $ENV{'REQUEST_URI'}; if ($disable) { &output_error("Script is disabled"); } print "Content-Type: text/html\n\n"; &printtop; if ($filech && $chnum) { &chmodfile($chnum, $filech); } &printtail; exit; sub chmodfile { local($a, $b) = @_; local($dochmod) = `chmod $a $b`; chop($dochmod); print $dochmod; print "Chmod executed!"; } sub printtop { print ""; print ""; print "Chmod a file"; print ""; print ""; print "
"; print "
"; print "File : "; print "

"; print "Chmod to : "; print "

"; print ""; print "

"; print "

"; print ""; } sub printtail { print ""; print "

"; print "
"; print ""; print ""; } sub output_error { local($errormsg) = @_; print "Content-Type: text/html\n\n"; print ""; print "

The following error has occured

"; print "

"; print "
"; 
print $errormsg; 
print "
"; print ""; exit; }