#!/usr/bin/perl
## Version 14:50 april 21 2003 - Julius B. Thijssen <jult@jult.net>
## Inserted you'll find some comments to explain where and
## how to change flow, and some other important stuff :

&parse_form;
$name = "jult.net";
## should be something unique for top of page etc.

$fontface = "Fixedsys, Courier New";
## if you don't get this, first learn a little about your o.s.

## You need to set the absolute server-path to your txt file,
## name it whatever you like, it is in fact html, so rant.htm is fine
$dtfl = "/home/sites/home/web/software/CGI/rant/jult.htm";
## The version you have before you now creates a file
## that will grow to around 30 kilobytes in size...

open ('dx1',"$dtfl");
@dtf = <dx1>;
close ('dx1');
if (@dtf eq ""){
$i = 0;
}
else{
$i = 0;
foreach $dtf (@dtf){
$i = $i + 1;
}
}
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/~!/ ~!/g;
$FORM{$name} = $value;
}
$compare = "$FORM{snd}";
if ($compare eq ""){
if ($ENV{'QUERY_STRING'} eq "log") {
}
else{

## some lines below this one you'll see the entry
## determining the maximum amount of characters per each entry
## search for 1001 (var max = 1001) in the below example

print ("Content-type: text/html\n\n");
print "<HEAD><TITLE>A sure sign of the times...</TITLE><STYLE MEDIA='screen' type='text/css'><!-- 
A:link {Color:#FF9F44;text-decoration:none} A:visited {text-decoration:none} A:hover {Color:#119900;text-decoration:underline;} body {scrollbar-face-color: #000000; scrollbar-shadow-color: #000000; scrollbar-highlight-color: #000000; scrollbar-3dlight-color: #CC6622; scrollbar-darkshadow-color: #000000; scrollbar-track-color: #995500; scrollbar-arrow-color: #EE8833}
 --></STYLE><script LANGUAGE='JavaScript'>
<!-- 
function Confirm(FormObject) { if(FormObject.cool.value == \"\" || FormObject.cool.value == null)
{ alert('Better type something first, OK?'); FormObject.cool.focus(); return false; } var max = 1001;
if(FormObject.cool.value.length > max) { alert('No more than 1001 characters at a time, sorry.'); FormObject.cool.value = \"\"; FormObject.cool.focus(); return false; } return true; }
// -->
</script></HEAD><BODY BGCOLOR='#000000' TEXT='#666666' LINK='#44AA00' VLINK='#FE9933'>
<FRAME NAME='99' ID='99' FRAMEBORDER='0' SCROLLING='No'><DIV id=img style='POSITION: absolute'><IMG onmousedown=pauseResume(); onmouseover=\"alert('Oh, get a life!')\" height=1 src='r.gif' width=1></DIV><SCRIPT language=JavaScript>
var step = 1; var delay = 22; var height = 0; var Hoffset = 0; var Woffset = 0; var yon = 0; var xon = 0; var pause = true; var interval; var name = navigator.appName; if(name == 'Microsoft Internet Explorer') name = true; else name = false; var xPos = 11; if(name) var yPos = document.body.clientHeight; else var yPos = window.innerHeight; function changePos() { if(name) { width = document.body.clientWidth; height = document.body.clientHeight; Hoffset = img.offsetHeight; Woffset = img.offsetWidth; img.style.left = xPos + document.body.scrollLeft; img.style.top = yPos + document.body.scrollTop; } else { height = window.innerHeight; width = window.innerWidth; Hoffset = document.img.clip.height; Woffset = document.img.clip.width; document.img.pageY = yPos + window.pageYOffset; document.img.pageX = xPos + window.pageXOffset; document.imd.pageY = yPos + window.pageYOffset; document.imd.pageX = xPos + window.pageXOffset; } if (yon) { yPos = yPos + step; } else { yPos = yPos - step; } if (yPos < 0) { yon = 1; yPos = 0; } if (yPos >= (height - Hoffset)) { yon = 0; yPos = (height - Hoffset); } if (xon) { xPos = xPos + step; } else { xPos = xPos - step; } if (xPos < 0) { xon = 1; xPos = 0; } if (xPos >= (width - Woffset)) { xon = 0; xPos = (width - Woffset); } } function start() { if(name) img.visibility = 'visible'; else document.img.visibility = 'visible'; interval = setInterval('changePos()',delay); } { if(pause) { clearInterval(interval); pause = false; }
else { interval = setInterval('changePos()',delay); pause = true; } }
start();
//  End -->
</SCRIPT><CENTER><font face='$fontface'><h2>$name<BR><A HREF='#A'>RANT CENTRAL</A></h2></font><TABLE WIDTH='87%' BORDER='0'>";
print "@dtf</TABLE><A NAME='A'><BR></A><form action=\"$ENV{\"SCRIPT_NAME\"}\" METHOD='POST' onSubmit='return Confirm(this)'><input type='Hidden' name='snd' value='2444211'><table border='0' cellpadding='2' cellspacing='0' width='87%'><tr><td width='95'><FONT FACE='$fontface'>Your text :</FONT></td><td width='500'><textarea width='100%' height='100%' name='cool' wrap='soft' cols='80' rows='1' STYLE='font-weight: bold;'></textarea></td></tr><tr><td width='95'><FONT FACE='$fontface'>Color:</FONT></td><td width='500'><select size='1' name='fontcolor'><option value='#FDFFFF'>Snowhite</option><option value='#FD0000'>Red</option><option value='#24DE00'>Green</option><option value='#0000FF'>Blue</option><option value='#AAAAA9'>Grey</option><option value='#FFFF00'>Yellow</option><option value='#FFCE00'>Gold</option><option value='#FF9F44'>Julty</option><option value='#FF8801'>Orange</option><option value='#CDC673'>Khaki</option><option value='#6B8E23'>Olive</option><option value='#B32220'>Firebrick</option><option value='#8A4413'>Chocolat</option><option value='#00DCFF'>Bluesy</option><option value='#4169E1'>Blueroyal</option><option value='#7FFFD4'>Aquamarine</option><option value='#00FFFF'>Cyan</option><option value='#DCFF00'>Hiphop</option><option value='#37CE32'>Lime</option><option value='#FFFFEE'>Papery</option><option value='#EFFFEF'>Honeydew</option><option value='#FEDAB5'>Peachy</option><option value='#FD9967'>Softy</option><option value='#EED8AD'>Wheat</option><option value='#DCDCDB'>Gains</option><option value='#F4F2DA'>Beige</option><option value='#9A3912'>Browny</option><option value='#B23446'>Maroon</option><option value='#9C7071'>Rosey</option><option value='#E3E4F9'>Lavender</option><option value='#2F4F4F'>Slate</option><option value='#202273'>Midnight</option><option value='#FF3300'>Love</option><option value='#444443'>Dark</option></select> &nbsp; <input type='submit' name='submit' value='Submit it'><input type='reset' name='reset' value='Clear field'></td></tr></table></form><FONT FACE='$fontface'><BR>* all is anonymous/censorfree *<BR>URLs become clickable but HTML gets stripped<BR><A HREF='/' TARGET=_top>home</A> | <A HREF='https://jult.net/faq.htm'>who</A> | <A HREF=ftp://jult.net/>ftp</A> | <A HREF='https://jult.net/software/' TARGET=_top>source</A> | entire script (c)<A HREF='https://jthz.nl/' TARGET=_top>jthz</A><BR>flow: 150 lines (new line in, oldest out) - max 1001 characters/entry<BR></FONT></CENTER></BODY></HTML>";
}
}
else{
$i = $i + 1;
open ('mx1',"$dtfl");
@datt = <mx1>;
close('mx1');


## below this you see the max amount of lines it will keep in jult.htm (minus one line)
## so, in the html above you change the flow, and change the datt entry below accordingly...

$#datt = 149;
open ('mx1',">$dtfl");
$Input =$FORM{'cool'};
$Input =~ s/<.*?>//g;
while($Input =~ s/  / /g){}
$Input =~ s/^\s+//;
$Input =~ s/\s+$//;
$Input =~ s/(\S+:\/\/\S+)/<A HREF=\"$1\" TARGET=_top>$1<\/A>/g;
$Input =~ s/\s(www\S+)/ <A HREF=\"https:\/\/$1\" TARGET=_top>$1<\/A>/g;
$Input =~ s/\n/<BR>/g;
print mx1 "\n<TR><TD VALIGN='top'><FONT FACE='$fontface' COLOR='$FORM{'fontcolor'}'>$Input</FONT></TD></TR>@datt";
close('mx1');
print ("Content-type: text/html\n\n");


## below this you see the page-URL it will return to after submitting an entry
## it is merely there for logging/thanking or blocking purposes,
## actual logging code is not in here, since I do that outside of this script..

print "<HTML><HEAD><META HTTP-EQUIV='Refresh' CONTENT=\"0; URL=https://jult.net/software/CGI/rant/jult.pl\"></HEAD><BODY><H2>your rant is now <A HREF='https://jult.net/software/CGI/rant/jult.pl'>public</A></H2></BODY></HTML>";
}
sub parse_form {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
if (length($buffer) < 5) {
$buffer = $ENV{QUERY_STRING};
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
}
