#!/usr/bin/perl # # viewtxt.pl v0.0.6 - View a plain text file in a HTML-document # Copyright (C) 2006, 2009, 2010 Stian Skjæveland # # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. # use CGI qw(:standard); use strict; print header; print qq(
We are now viewing a plain text file inside of a HTML-document. Just for making things easy for you as a reader. ); print "Back to previous page."; print qq(
);
my $param_txtfile=param('txtfile');
my $privdir="/home/stunix/domains/atlantiscrew.net/public_html/stian";
my $full=$privdir.=$param_txtfile;
my @txtlines;
if ((!$full=~/doc/)) {
&filenotfound();
exit(0);
}
open(PLAINTXTFILE, "<$full") || die(&filenotfound());
print @txtlines=;
close(PLAINTXTFILE);
print qq(
);
print "End of file $param_txtfile. (View/download the original file.) ";
&endtext();
sub filenotfound() {
print qq(
);
print "Cannot find (or get access to) file '$param_txtfile': $!";
print qq(
); &endtext(); } sub endtext() { print "
Go back to previous page."; print qq(