#!/usr/bin/perl # # viewtxt.pl v0.0.7 - View a plain text file in a HTML-document # Copyright (C) 2006, 2009, 2010, 2011 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( View plan text file

View plain text file

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(


Copyright (C) 2006, 2009, 2010, 2011 Stian Skjæveland.
Verbatim copying and redistribution of this entire page are permitted provided thisnotice is preserved.

Powered by Perl Valid HTML 4.01! Valid CSS! Creative Commons License ); }