| Server IP : 216.92.14.13 / Your IP : 216.73.216.171 Web Server : Apache System : Linux vps4089.pairvps.com 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 User : rmlac2fmr ( 1040637) PHP Version : 8.2.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/www/cgi-bin/ |
Upload File : |
#!/usr/bin/perl -w
#
# $Id: rand_text.pl,v 1.10 2002/06/01 09:16:50 nickjc Exp $
#
use strict;
use CGI qw(header);
use vars qw($DEBUGGING $done_headers);
# Configuration
#
# $DEBUGGING must be set in a BEGIN block in order to have it be set before
# the program is fully compiled.
# This should almost certainly be set to 0 when the program is 'live'
#
BEGIN
{
$DEBUGGING = 0;
}
my $random_file = '/path/to/random.txt';
my $delimiter = "%%\n";
# End configuration
# We need finer control over what gets to the browser and the CGI::Carp
# set_message() is not available everywhere :(
# This is basically the same as what CGI::Carp does inside but simplified
# for our purposes here.
BEGIN
{
sub fatalsToBrowser
{
my ( $message ) = @_;
if ( $main::DEBUGGING )
{
$message =~ s/</</g;
$message =~ s/>/>/g;
}
else
{
$message = '';
}
my ( $pack, $file, $line, $sub ) = caller(1);
my ($id ) = $file =~ m%([^/]+)$%;
return undef if $file =~ /^\(eval/;
print "Content-Type: text/html\n\n" unless $done_headers;
print <<EOERR;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Error</title>
</head>
<body>
<h1>Application Error</h1>
<p>
An error has occurred in the program
</p>
<p>
$message
</p>
</body>
</html>
EOERR
die @_;
};
$SIG{__DIE__} = \&fatalsToBrowser;
}
open(FILE, "<$random_file")
or die "Can't open $random_file: $!\n";
my @phrases;
{
local $/ = $delimiter;
chomp (@phrases = <FILE>);
}
my $phrase = $phrases[rand(@phrases)];
print header(-type => 'text/plain');
$done_headers++;
print $phrase;
close(FILE);