perl:start
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| perl:start [13/09/2023 17:11] – created - external edit 127.0.0.1 | perl:start [10/05/2026 00:46] (current) – [my-ip.pl] andrew | ||
|---|---|---|---|
| Line 109: | Line 109: | ||
| exit (0); | exit (0); | ||
| </ | </ | ||
| + | |||
| + | |||
| + | ==== convert2html.pl ==== | ||
| + | |||
| + | Convert to HTML | ||
| + | |||
| + | |||
| + | < | ||
| + | # | ||
| + | #written by Andrew Stringer 30-04-2006 | ||
| + | #this is intended to be run from an ssi:- | ||
| + | #< | ||
| + | #it takes an html file or xml file and converts the < to < etc. and | ||
| + | #prints to stdout enclosed in a <pre> </ | ||
| + | #to appear in web pages correctly formatted. | ||
| + | |||
| + | use warnings; | ||
| + | use strict; | ||
| + | |||
| + | MAIN: | ||
| + | { | ||
| + | my $line; | ||
| + | #set prefix to path to webroot | ||
| + | my $prefix = '/ | ||
| + | my $query = $ENV{' | ||
| + | |||
| + | my $debug = ' | ||
| + | |||
| + | #remove double dots (..) to prevent file system traversal | ||
| + | #Only naughty boys would want to do this, should not affect normal users. | ||
| + | $query =~ s/\.\.//g; | ||
| + | $query =~ s/ | ||
| + | |||
| + | #only allow files below the webroot to be readout | ||
| + | my $url = " | ||
| + | |||
| + | open (FILE, " | ||
| + | |||
| + | print " | ||
| + | |||
| + | if($debug){ | ||
| + | print " | ||
| + | print "URL is $url \n"; | ||
| + | } | ||
| + | |||
| + | print "< | ||
| + | |||
| + | while ($line = < | ||
| + | { | ||
| + | #use /g to catch all occurances on each line | ||
| + | $line =~ s/ | ||
| + | $line =~ s/ | ||
| + | |||
| + | print $line; | ||
| + | } | ||
| + | print "</ | ||
| + | |||
| + | } | ||
| + | exit(0); | ||
| + | |||
| + | </ | ||
| + | |||
perl/start.1694625068.txt.gz · Last modified: by 127.0.0.1
