#!/usr/bin/perl &call_log; &get_data; $view=$data{"View"}; $img=$data{"img"}; $x=$data{"x"}; $y=$data{"y"}; $sescnt=$data{"z"}; $ipaddress =$ENV{'REMOTE_ADDR'}; @nvpairs=split(/; /, $ENV{'HTTP_COOKIE'}); foreach $pair (@nvpairs) { ($name, $value) = split(/=/, $pair); $cookie{$name} = $value; } $session = $cookie{'session'}; if ($sescnt eq $session) {$img="";} print "Set-Cookie\:session=$sescnt\n"; print "Content\-type\:text\/html\n\n"; $sescnt++; @color=("254\|254\|254", "73\|62\|40", "234\|56\|28", "179\|135\|196", "246\|159\|90", "255\|213\|13", "169\|126\|143", "56\|69\|101", "217\|225\|176", "254\|254\|254", "146\|162\|63", "71\|117\|186", "40\|112\|220", "73\|106\|51", "215\|42\|44"); open (FILE, "paintdb"); @paint=; close FILE; if ($view eq "yes") {&view;exit;} if ($img ne "") {&add;} $screen=pop @paint; chomp $screen; @screen=split(/\|/,$screen); @code[0]="fill"; @code[1]=int(rand(15))+1;@code[4]=int(rand(15))+1; @code[3]=int(rand(15))+1; @code[2]=int(rand(15))+1; if ($img ne "") {@code[1]=$img;} while ( @code[2] == @code[1]) { @code[2]=int(rand(15))+1; } while (@code[3] == @code[1] || @code[3] == @code[2]) { @code[3]=int(rand(15))+1; } while (@code[4] == @code[1] || @code[4] == @code[2] || @code[4] == @code[3]) { @code[4]=int(rand(15))+1; } $ip=shift @screen; foreach $box (@screen) {$co=$box-1; ($thisred, $thisblue, $thisgreen)=split(/\|/,@color[$co]); $allred+=$thisred; $allblue+=$thisblue; $allgreen+=$thisgreen; } $red=sprintf "%1x", int($allred/96); $green=sprintf "%1x", int($allgreen/96); $blue=sprintf "%1x", int($allblue/96); $redtext=sprintf "%1x", int($allred/384); $greentext=sprintf "%1x", int($allgreen/384); $bluetext=sprintf "%1x", int($allblue/384); $redhi=sprintf "%1x", int($allred/111); $greenhi=sprintf "%1x", int($allgreen/111); $bluehi=sprintf "%1x", int($allblue/111); $w=0; print <COMPAINT - Community art
TABLETOP &get_maps; foreach $box (@screen) { if ($w == 64 || $w == 65 || $w == 66 || $w == 67) { $r++; print <
CLICK } else { print < ONEBOX } if ($w%12 == 11) {print "
";} $w++; } print "
"; if ($sescnt > 5) { print <
view all

VIEW } print <

GRAPH sub add { $onelast=pop @paint; chomp $onelast; push (@paint, $onelast); @last=split(/\|/,$onelast); $coord=(($y-1)*12)+$x; @last[0]=$ipaddress; @last[$coord]=$img; $newlast=join("\|",@last); push (@paint, $newlast); $newlast.="\n"; open (FILE, ">>paintdb"); print FILE $newlast; close FILE; } sub get_data { local($string); # get data if ($ENV{'REQUEST_METHOD'} eq 'GET') { $_ = $string = $ENV{'QUERY_STRING'}; tr/\"~;/_/; $string = $_; } else { read(STDIN, $string, $ENV{'CONTENT_LENGTH'}); $_ = $string; $OK_CHARS='a-zA-Z0-9=&%\n\/_\-\.@'; tr/\"~;/_/; $string = $_; } # split data into name=value pairs @data = split(/&/, $string); # split into name=value pairs in associative array foreach (@data) { split(/=/, $_); $_[0] =~ s/\+/ /g; # plus to space $_[0] =~ s/%(..)/pack("c", hex($1))/ge; # hex to alphanumeric $data{"$_[0]"} = $_[1]; } # translate special characters foreach (keys %data) { $data{"$_"} =~ s/\+/ /g; # plus to space $data{"$_"} =~ s/%(..)/pack("c", hex($1))/ge; # hex to alphanumeric } %data; # return associative array of name=value } sub call_log { $logfileaxs = 'log.txt'; $domainaxs = 'http://www.blacksunn.net/'; $headeraxs = "Content-type: text/html\n\n"; $ENV{'REMOTE_HOST'} =~ tr/[A-Z]/[a-z]/; $logline = "|$ENV{'REMOTE_HOST'}|$ENV{'REMOTE_ADDR'}|"; $ENV{'HTTP_REFERER'} =~ s/\|//g; $logline .= "$ENV{'HTTP_REFERER'}|"; $logline .= "$domainaxs$ENV{'DOCUMENT_URI'}|"; $logline .= "$ENV{'HTTP_USER_AGENT'}|"; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime(time); $logline .= "$sec|$min|$hour|$mday|$mon|$year|$wday|$yday|"; # $logline .= "export|"; $logline .= "\n"; open(LOG,">>$logfileaxs"); print LOG $logline; close(LOG); } sub get_maps { @coordmap= ("1,1,4,6", "5,1,8,6", "9,1,13,6", "14,1,17,6", "18,1,21,6" , "22,1,25,6", "26,1,29,6", "30,1,33,6", "34,1,37,6", "38,1,41,6", "42,1,45,6", "46,1,50,6", "1,6,4,12", "5,6,8,12", "9,6,13,12", "14,6,17,12", "18,6,21,12", "22,6,25,12", "26,6,29,12", "30,6,33,12", "34,6,37,12", "38,6,41,12", "42,6,45,12", "46,6,50,12", "1,13,4,19", "5,13,8,19", "9,13,13,19", "14,13,17,19", "18,13,21,19", "22,13,25,19", "26,13,29,19", "30,13,33,19", "34,13,37,19", "38,14,41,19", "42,14,45,19", "46,14,50,19", "1,20,4,26", "5,20,8,26", "9,20,13,26", "14,20,17,26", "18,20,21,26", "22,20,25,26", "26,20,29,26", "30,20,33,26", "34,20,37,26", "38,20,41,26", "42,20,45,26", "46,20,50,26", "1,27,4,32", "5,27,8,32", "9,27,13,32", "14,27,17,32", "18,27,21,32", "22,27,25,32", "26,27,29,32", "30,27,33,32", "34,27,37,32", "38,27,41,32", "42,27,45,32", "46,27,50,32", "1,33,4,38", "5,33,8,38", "9,33,13,38", "14,33,17,38", "18,33,21,38", "22,33,25,38", "26,33,29,38", "30,33,33,38", "34,33,37,38", "38,33,41,38", "42,33,45,38", "46,33,50,38", "1,39,4,44", "5,39,8,44", "9,39,13,44", "14,39,17,44", "18,39,21,44", "22,39,25,44", "26,39,29,44", "30,39,33,44", "34,39,37,44", "38,39,41,44", "42,39,45,44", "46,39,50,44", "1,45,4,50", "5,45,8,50", "9,45,13,50", "14,45,17,50", "18,45,21,50", "22,45,25,50", "26,45,29,50", "30,45,33,50", "34,45,37,50", "38,45,41,50", "42,45,45,50", "46,45,50,50"); @code1[1]=int(rand(4))+1;@code1[4]=int(rand(4))+1; @code1[3]=int(rand(4))+1; @code1[2]=int(rand(4))+1; @code1[0]="fill"; while ( @code1[2] == @code1[1]) { @code1[2]=int(rand(4))+1; } while (@code1[3] == @code1[1] || @code1[3] == @code1[2]) { @code1[3]=int(rand(4))+1; } while (@code1[4] == @code1[1] || @code1[4] == @code1[2] || @code1[4] == @code1[3]) { @code1[4]=int(rand(4))+1; } foreach $i (1...4) { @xarray=(); @yarray=(); print ""; if (@code1[$i] == 1) { @xarray=("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); @yarray=("1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "7", "7", "7", "7", "7", "7", "7", "7", "7", "7", "7", "7", "8", "8", "8", "8", "8", "8", "8", "8", "8", "8", "8", "8"); } if (@code1[$i] == 2) { @xarray=("12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1"); @yarray=("8", "8", "8", "8", "8", "8", "8", "8", "8", "8", "8", "8", "7", "7", "7", "7", "7", "7", "7", "7", "7", "7", "7", "7", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1"); } if (@code1[$i] == 3) { @xarray=("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); @yarray=("8", "8", "8", "8", "8", "8", "8", "8", "8", "8", "8", "8", "7", "7", "7", "7", "7", "7", "7", "7", "7", "7", "7", "7", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1"); } if (@code1[$i] == 4) { @xarray=("12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1", "12", "11", "10", "9", "8", "7", "6", "5", "4", "3", "2", "1"); @yarray=("1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "4", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "5", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "7", "7", "7", "7", "7", "7", "7", "7", "7", "7", "7", "7", "8", "8", "8", "8", "8", "8", "8", "8", "8", "8", "8", "8"); } foreach $j (0...95) { print < EACHLINE } print "<\/map>"; } } sub view { print < SCRIPT2 print <COMPAINT - Community art
TOPOFPAGE foreach $gridbox (1...96) { $eioueno=$gridbox%15+1; $ieueibe=$gridbox-1; print < BOX if ($gridbox%12 == 0) {print "";} } print "<\/tr><\/table>

"; print "<\/td><\/tr><\/table>"; }