#!/usr/bin/perl # # Webcluster-Client DB0LJ-6 # # (C) Hans-J. Barthen, DL5DI # Franz-Josef-Str. 20 # D-56642 Kruft # # 07.02.2008 1.Beta-Version # 08.02.2008 1.active version at dx.db0lj.de # 10.02.2008 URL generation for qrz.com added # 19.02.2008 1st release for download on the web # 24.02.2008 automatic creation of cnt-file # 25.02.2008 convert special characters to html-codes # 09.03.2008 show newest records first # 07.01.2010 show date in WCY and WWV datas to recognize entries older than a day # 30.06.2010 typo in timestamp of WWV/WCY brought up wrong month - fixed # $| = 1; # flush print and write $rev = "20100630"; # clear content of variables $spot[1] = ""; $spot[2] = ""; $spot[3] = ""; $spot[4] = ""; $spot[5] = ""; $spot[6] = ""; $spot[7] = ""; $spot[8] = ""; $spot[9] = ""; $spot[10] = ""; $spot[11] = ""; $spot[12] = ""; $spot[13] = ""; $spot[14] = ""; $spot[15] = ""; $spot[16] = ""; $spot[17] = ""; $spot[18] = ""; $spot[19] = ""; $spot[20] = ""; $ann[1] = ""; $ann[2] = ""; $ann[3] = ""; $wcy[1] = ""; $wcy[2] = ""; $wcy[3] = ""; $wwv[1] = ""; $wwv[2] = ""; $wwv[3] = ""; # get actual date and time to create the dxspider directory and filenames ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst)=gmtime(time); $mon++; $yday++; $year+=1900; # save a copy for the timestamp in the bottom of the page $stamp=sprintf("%2.2d:%2.2d:%2.2d UTC",$hour,$min,$sec); # create filenames $spotfile=sprintf("/spider/data/spots/%4.4d/%3.3d.dat",$year,$yday); $annfile=sprintf("/spider/data/log/%4.4d/%2.2d.dat",$year,$mon); $wcyfile=sprintf("/spider/data/wcy/%4.4d/%2.2d.dat",$year,$mon); $wwvfile=sprintf("/spider/data/wwv/%4.4d/%2.2d.dat",$year,$mon); $dxccfile=sprintf("/spider/data/dxcc.list"); # read and increase hit counter if (open(CNTFILE, "/var/local/httpd/cgi-bin/webcluster.cnt")) { $cnt = ; close(CNTFILE); chop($cnt); $cnt++; } else { $cnt = 1; } # write counter back to file if (open(CNTFILE, ">/var/local/httpd/cgi-bin/webcluster.cnt")) { printf(CNTFILE "$cnt\n"); close(CNTFILE); } ##################### Number of spots, min, max, default ############## if ($ARGV[0] > 0) { # min $n = $ARGV[0]; if($n > 50) { $n == 50; # max } } else { $n = 20; # default } ###################### HTML-Header ######################## print(""); print(""); print(""); print(" "); print(" "); print(" "); print(" "); print(" "); print(" "); print(" DX-Cluster Koblenz - DB0LJ-6"); print(""); print(""); print("
"); print(""); print(""); print(""); print(""); print(""); print("
DX-Cluster Koblenz - DB0LJ-6
"); print(""); ###################################################################### # # Create dynamic tables / be careful with changes here! # ###################################################################### #################### DX-Spots ########################## if(open(SPOTS, $spotfile)) { while($line = ) { chop($line); for($i = $n;$i > 1; $i--) { $spot[$i] = $spot[$i-1]; } $spot[1] = $line; } $i = 1; # Table start print("
"); while($i <= $n) { ($qrg,$call,$zeit,$text,$spotter,$dxcc,$dummy,$dummy,$itu,$cq,$dummy) = split(/\^/,$spot[$i],11); # fix some special chars which may destroy the table structure $text =~ s/\;/:/g; $text =~ s|\\|\/|g; $text =~ s/\&/&/g; $text =~ s/\$/§/g; $text =~ s/\|/¦/g; $text =~ s//>/g; $text =~ s/\"/"/g; $text =~ s/ä/ä/g; $text =~ s/ö/ö/g; $text =~ s/ü/ü/g; $dbi = 1; if(open(DXCC, $dxccfile)) { while($dbi < $dxcc) { $dbline = ; $dbi++; } $pfx = ; close(DXCC); } if((length($spotter) > 0)) { print(""); printf("",$spotter); printf("",$qrg); if(index($call,'/') > 0){ ($teil1,$teil2) = split(/\//,$call,2); if(length($teil2) < length($teil1)) { $qrzcall = $teil1; } else { ($qrzcall,$dummy) = split(/\//,$teil2,2); } } else { $qrzcall = $call; } $tmp = $qrzcall; $num = $tmp =~ tr/0-9//; $tmp = $qrzcall; $abc = $tmp =~ tr/A-Za-z//; if((index($qrzcall,'/') > 0) || ($num == 0) || ($abc < 2)) { printf("",$call); } else { printf("",$qrzcall,$call); } printf("",$text); printf("",$pfx); # printf("",$itu); printf("",$cq); ($sec,$min,$std,$mtag,$jahr,$wtag,$jtag,$somzeit) = gmtime($zeit); printf("",$std,$min); print(""); } $i++; } close(SPOTS); # Table end print("
DX de %s:%10.1f%15.15s%15.15s%30.30s%2.2s%2.2s%2.2s%2.2d%2.2dZ
"); } #################### WCY-Datas ########################## if(open(WCYS, $wcyfile)) { while($line = ) { chop($line); $wcy[3] = $wcy[2]; $wcy[2] = $wcy[1]; $wcy[1] = $line; } $i = 1; # Table start print(""); while($i <= 3) { ($zeit,$sfi,$a,$k,$expk,$r,$sa,$gmf,$aurora,$spotter,$dummy) = split(/\^/,$wcy[$i],11); if($sa eq "qui") { $sa = "quiet"; } elsif ($sa eq "act") { $sa = "active"; } if($gmf eq "qui") { $gmf = "quiet"; } elsif ($gmf eq "act") { $gmf = "active"; } ($sec,$min,$std,$mtag,$monat,$jahr,$wtag,$jtag,$somzeit) = gmtime($zeit); if((length($spotter) > 0)) { print(""); printf("",$spotter); printf("",$jahr+1900,$monat+1,$mtag,$std,$min); printf("",$sfi); printf("",$a); printf("",$k); printf("",$expk); printf("",$r); printf("",$sa); printf("",$gmf); if($aurora eq "yes") { printf(""); } else { printf("",$aurora); } print(""); } $i++; } close(WCYS); # Table end print("
WCY de %s%4.4d/%2.2d/%2.2d %2.2d%2.2dZSFI=%dA=%dK=%dexpK=%1dR=%dSA: %sGMF: %sAurora: !YES!Aurora: %s
"); } #################### WWV-Datas ########################## if(open(WWVS, $wwvfile)) { while($line = ) { chop($line); $wwv[3] = $wwv[2]; $wwv[2] = $wwv[1]; $wwv[1] = $line; } $i = 1; # Table start print(""); while($i <= 3) { # print "$wwv[$i]\n"; ($spotter,$zeit,$sfi,$a,$k,$text,$dummy) = split(/\^/,$wwv[$i],7); ($sec,$min,$std,$mtag,$monat,$jahr,$wtag,$jtag,$somzeit) = gmtime($zeit); if((length($spotter) > 0)) { print(""); printf("",$spotter); printf("",$jahr+1900,$monat+1,$mtag,$std,$min); printf("",$sfi); printf("",$a); printf("",$k); $text =~ tr/<>/ /; printf("",$text); print(""); } $i++; } close(WWVS); # Table end print("
WWV de %s%4.4d/%2.2d/%2.2d %2.2d%2.2dZSFI=%dA=%dK=%d%s
"); } #################### Announcements ########################## if(open(ANNS, $annfile)) { # Table start print(""); while($line = ) { chop($line); ($zeit,$flag,$dummy) = split(/\^/,$line,3); if($flag eq 'ann') { $ann[3] = $ann[2]; $ann[2] = $ann[1]; $ann[1] = $line; } } $i = 1; while($i <= 3) { ($zeit,$flag,$dest,$spotter,$text,$dummy) = split(/\^/,$ann[$i],6); ($sec,$min,$std,$mtag,$jahr,$wtag,$jtag,$somzeit) = gmtime($zeit); if((length($spotter) > 0)) { print(""); printf("",$dest,$spotter); printf("",$std,$min); printf("",$text); print(""); } $i++; } close(ANNS); # Table end print("
To %s de %s%2.2d%2.2dZ%s
"); } ###################### HTML-Footer ################################ # # Place some URLs or other information here. # The update interval, the timestamp of the last update ($stamp) # and the hit-counter ($cnt) can be placed here # print(""); print(""); print""; print""; print""; print(""); print("
Quelle: http://dx.db0lj.de$stamp (Refresh nach 120s)Web Interface by DL5DI, $rev
"); print(""); print(""); print""; print""; print(""); print("
Online-Zugang via Java-Client (Registrierung für Schreibzugriff bei afuforum.prgm.org)$cnt
"); print(""); print""; exit;