matrix_man has asked for the wisdom of the Perl Monks concerning the following question:
PERL:<html> <body> <form method=post> <input name=text1><br> <input type=submit value=submit id=submit1 name=submit1> </form> <% dim user dim wshell user=trim(request.form("text1")) if len(user) > 0 then response.write "<hr>user: " & user set wshell = createobject("wscript.shell") '=== ' assume script is in same folder as page... '=== sScript = server.mappath("test1.pl") '=== ' run script in hidden window... '=== wshell.run "perl """ & sScript & """ " & user, 0, false set wshell = nothing end if %> </body> </html>
# Variables # $quit_loop = 0; $found_name = 0; @username = @ARGV; $loop = 0; # Converting username to correct format for comparison search $username[0] = substr($username[0], 1, 4); if ( substr($username[0], 0, 1) eq "0" ) { $username[0] = substr($username[0], 1, 3); } # Cleaning up the Kronos document open(ORIGFILE,"current") || die "cannot open current for reading"; open(REVFILE,">revfile") || die "cannot open revfile for writing"; while (<ORIGFILE>) # read each line of ORIGFILE { if (/South/) # If a South Bend Line { <ORIGFILE>; <ORIGFILE>; <ORIGFILE>; } elsif (/-+/) { print REVFILE $_; <ORIGFILE>; <ORIGFILE>; } else { print REVFILE $_; } } close(ORIGFILE); close(REVFILE); # Searching for the correct username to return data to another file open(REVFILE, "revfile") || die "cannot open revfile for reading"; open(FINALFILE, ">finalfile.txt") || die "cannot open finalfile for wr +iting"; while (<REVFILE>) { # Converting Kronos username for comparison $current_line = $_; $current_id = substr($current_line, 33, 4); if ( substr($current_id, 0, 1) eq "0" ) { $current_id = substr($current_id, 1, 3); } if ( substr($current_id, 3, 1) eq " ") { $current_id = substr($current_id, 0, 3); } unless ($quit_loop == 1 ) { if ($found_name == 1) { if (/-+/) { $quit_loop = 1; } else { print FINALFILE $_; } } elsif ($current_id eq $username[0]) { $found_name = 1; print FINALFILE $_; } else { $found_name = 0; } } } $quit_loop = 0; print FINALFILE $path; close(REVFILE); close(FINALFILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IIS and Perl, yippee
by !me (Acolyte) on Jul 20, 2001 at 21:49 UTC | |
by matrix_man (Initiate) on Jul 20, 2001 at 22:25 UTC | |
by matrix_man (Initiate) on Jul 20, 2001 at 22:42 UTC | |
|
Re: IIS and Perl, yippee
by gregorovius (Friar) on Jul 21, 2001 at 01:20 UTC | |
by matrix_man (Initiate) on Jul 21, 2001 at 17:11 UTC | |
by gregorovius (Friar) on Jul 21, 2001 at 18:42 UTC | |
by matrix_man (Initiate) on Jul 23, 2001 at 17:52 UTC |