When you look at the following Perl program which probes a NT domain for servers using Win32::NetAdmin::GetServers, and runs Win32::AdminMisc::GetDriveSpace( $UNCPath ) to retrieve disk utilization, how do you see the data getting written to "$my_dir/DiskSpace.txt" found in the subroutine show_it and the end of this script? As a rookie Perl guy, I'm thinking it is in the statement print '<form method=post action="../../cgi-bin/users/get_dir_sec.pl">'; of the get_info subroutine. Correct? or not.
The statement below the post, print '<input type="hidden" name="qrytype" value="dir">'; looks like it is applying all of the results of the Win32::AdminMisc::GetDriveSpace( $UNCPath ) disk space information to the get_dir_sec.pl, no? Finally, how would the script that you post to, in this case get_dir_sec.pl be written to receive the data and write it to "$my_dir/DiskSpace.txt"? Thanks in advance for your help, Dan --------------------------------------------------------- #!perl -w # amonotod # 15 Oct 1999 # drive_space.pl, for use on WinNT Servers # Partly mine, partly by others... # Thank you to the others! # The stuff in the BEGIN block will be executed very early # on, even before the rest of this script is parsed. # BEGIN { # Use the CGI::Carp module and import the carpout() function. # use CGI::Carp qw(carpout); # Send warnings and die messages to the browser. # carpout(STDOUT); } use Win32::NetAdmin; use Win32::AdminMisc; my $Domain = 'ROSENET'; my $Flags = SV_TYPE_DOMAIN_CTRL | 0x00008000; my ( @Servers, @Alphabet, $Server, $UNCPath, $Count, $Date ); my ( $Total, $Free, $Used, $TotalMod, $UsedMod, $FreeMod, $Warning ); $Date = localtime(); $my_dir = "d:/www/cgi_bin/users"; &print_html; &get_info; &show_it; exit; sub print_html{ print "Content-type: text/html\n\n"; } sub get_info{ Win32::NetAdmin::GetServers( '', $Domain, $Flags, \@Servers ) ;#or die "Can't get servers from domain $Domain: $!"; foreach $Server ( sort( @Servers ) ) { print "<h2>Drives on $Server:</h2>\n"; #print "$Server<br>\n"; print '<form method=post action="../../cgi-bin/users/get_dir_sec.pl">'; print '<input type="hidden" name="qrytype" value="dir">'; #print "\n"; @Alphabet = ( "a".."z" ); $Count = 0; while ( $Alphabet[$Count] ne "" ) { $UNCPath = "\\\\"."$Server"."\\"."\_"."$Alphabet[$Count]"."\$"; if ( ( $Total, $Free ) = Win32::AdminMisc::GetDriveSpace( $UNCPath ) ) { if ( ($Total + $Free) > 0 ){ print "<br>\n"; print '<input type="radio" name="dir" value="'."$UNCPath".'">'."$UNCPath".'</input><br>'; #print "$Total $Free<br>\n"; } $Used = $Total - $Free ; $Warning = ( ( $Used / $Total ) * 100 ); if ( $Total > "1000000000" ) { $TotalMod = $Total/1000000000; $TotalMod = substr ($TotalMod,0,4); $TotalMod = $TotalMod." GB"; print "$TotalMod Total disk space<br>\n "; } elsif ($Total < "1000000000") { $TotalMod = $Total/1000000; $TotalMod = substr ($TotalMod,0,4); $TotalMod = $TotalMod." MB"; print "$TotalMod Total disk space<br>\n"; } if ($Free > "1000000000") { $FreeMod = $Free/1000000000; $FreeMod = substr ($FreeMod,0,4); $FreeMod = $FreeMod." GB"; print "$FreeMod Free disk space<br>\n"; } elsif ($Free < "1000000000") { $FreeMod = $Free/1000000; $FreeMod = substr ($FreeMod,0,4); $FreeMod = $FreeMod." MB"; print "$FreeMod Free disk space<br>\n"; } if ($Used > "1000000000") { $UsedMod = $Used/1000000000; $UsedMod = substr ($UsedMod,0,4); $UsedMod = $UsedMod." GB"; print "$UsedMod Used disk space<br>\n"; } elsif ($Used < "1000000000") { $UsedMod = $Used/1000000; $UsedMod = substr ($UsedMod,0,4); $UsedMod = $UsedMod." MB"; print "$UsedMod Used disk space<br>\n"; } } $Count++ } print '<br><h2>Username and password required for access to security info.</h2>'; print 'Username: <input type=text name=username size=25 maxlength=25><br>'; print 'Password: <input type=password name=password size=14 maxlength=14><br>'; print '<input type=submit value="Get Info">'; } } sub show_it { open (MY_RESULT,"$my_dir/DiskSpace.txt"); $show_it_inc = 0; while (<MY_RESULT>) { $show_results{$show_it_inc} = "$_"; $show_it_inc++; } close (MY_RESULT); } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]