#!/usr/bin/perl use CGI qw(:standard); my $cgi = new CGI; $i = 0; $connect = 0; make_connection(); cut_connection(); sub make_html { use Spreadsheet::ParseExcel::Simple; print $cgi->header(); print $cgi->start_html('7513 Interface Descriptions'); print "<H1><center>7513 Interface Descriptions</H1>\n"; print "<Table border = 1>\n"; $xls = Spreadsheet::ParseExcel::Simple->read('/root/FLA_DHRS/S +HRHZ006/7513.xls'); foreach $sheet ($xls->sheets) { while ($sheet->has_data) { @data = $sheet->next_row; print " <tr>\n"; #print "@data\n"; foreach $element (@data) { if ($i <= 2) { print "<td><b><center>$element</td></b></cent +er>\n"; $i++; } else { print "<td><center>$element</t +d></ceneter>\n"; } } print " </tr>\n"; } } print end_html; } sub make_connection { if($connect eq 0) { system("/usr/local/bin/ncpmount -S server -A ip address -V /vol2/ISPSNC/PortAssignments -U username -P password /root/FLA_DHRS/SHRHZ006"); $connect = 1; } else { $connect = 0; error(); } if($connect eq 1) { make_html(); } } sub cut_connection { if ($connect eq 1) { system('ncpumount -S server'); } } sub error { print $cgi->header(); print $cgi->start('Error'); print "<center>"; print "<H2> Error: Could not connect to server </H2>"; print "Please Try again later"; print "<HR></center>"; print end_html; }
Retitled from "Racking My Brain!" by Chady
In reply to permission problems between commandline and CGI by parkprimus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |