Quite some time ago I read a rant complaining about how information on the internet doesn't age our wear down. I thought it was pretty interesting, but I forgot about it till now. Anyway, I wrote this little script that allows users to post messages that fade away over time (more specifically they fade a little every time the page gets a hit) and eventually dissapear. You can see this running
here. And here is the code:
#!/usr/bin/perl
use strict;
use CGI qw( header param );
my $new = param("post");
my @pallet = qw( 000000 1E1E1E 3C3C3C 5A5A5A 787878 969696 B4B4B4 D2D2
+D2 F0F0F0 );
my $url = "http://yoursite.org/url/for/cgi";
if ($new) {
open(POSTS, ">>/path/to/message/file");
print POSTS "0 $new\n";
print header;
print "<PRE>meme added\n<A HREF=\"$url">go back</a></pre>";
} else {
open(POSTS,"/path/to/message/file");
my @posts = <POSTS>;
my $post;
print header;
foreach $post(@posts) {
$post =~ /(\d) (.*)/;
my $shade = @pallet[$1];
my $text = $2;
my $x = int(rand 400);
my $y = int(rand 400);
my $z = int(rand 5);
$z++;
print "<font color=#$shade size=$z STYLE=\"position:relative; left:" .
+ $x . "px; top:" . $y . "px\"> $text </font>\n";
}
close(POSTS);
open(POSTS, ">/path/to/message/file");
foreach $post(@posts) {
$post =~ /(\d) (.*)/;
my $num = $1;
my $mesg = $2;
$num++;
if ($num == 9) {
1;
} else {
print POSTS "$num $mesg\n";
}
}
print <<CREATE;
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<table>
<tr>
<td bgcolor=#08082C>
<BR>
<FORM METHOD="GET" ACTION="$url">
Meme:<INPUT TYPE="text" STYLE="background-color:#B4B4B4" NAME="post" S
+IZE="30">
<INPUT TYPE="submit" value="create">
</form>
<BR>
</td>
</tr>
</table>
CREATE
}
BTW I know all those BR tags are annoying, sorry about that
"Sanity is the playground of the unimaginative"
-Unknown