#!/usr/bin/perl
###DO NOT EDIT BELOW HERE
use LWP::UserAgent;
require "lib.pl";
require "options.pl";
$dbfile = $members_dbfile;
$master = $members_master;
$row = 0;
$listrank = 0;
%colors = (
"PHANTASM" => "blue",
"NETHER" => "black",
"ASCENDANT" => "white",
"VERDANT" => "green",
"ERADICATION" => "red"
);
%subServers = (
"s1" => "arch15",
"s2" => "arch10",
"a1" => "arch11",
"a2" => "arch12",
"b1" => "arch8",
"b2" => "arch6",
"b3" => "arch4",
"be" => "arch18",
"ap" => "arch9",
);
%serverCookies = (
"s1" => "ArchServer1",
"s2" => "ArchServer2",
"a1" => "AgerArchmage1",
"a2" => "AgerArchmage2",
"b1" => "ArchBlitz1",
"b2" => "ArchBlitz2",
"b3" => "ArchBlitz3",
"be" => "ArchBeta",
"ap" => "ArchmageNewbie",
);
$archCookie = 'HFR5E1F3M3S14H';
if (open(FH,"< $dbfile")) {
while (<FH>) {
chomp;
if (/#/) { } else {
($num,$i,$hid) = split(/\|/,$_);
push(@ids,$num);
$info{$num} = $i;
}
}
close(FH);
}
$ua = new LWP::UserAgent;
my $req = new HTTP::Request 'POST',"
http://".$subServers{$server}.".magewar.com/archmage/idsearch.html";$req->header(Cookie => $serverCookies{$server}."ID=".$archCookie);
$req->header(Connection => 'Keep-Alive');
$req->content_type('application/x-www-form-urlencoded');
foreach $n (@ids) {
$readname = 0;
$req->content("option=1&targetid=$n");
my $res = $ua->request($req);
if ($res->is_success) {
@content = split(/\n/,$res->content);
foreach (@content) {
if ((/Country<\/TH><TD\sWIDTH\s=\s300>(.*?)\s\(#/) && ($readname == 0)) {
$name = $1;
$id = $n;
$readname = 1;
} elsif (/Status<\/TH><TD>(.*?)<\/TD>/) {
$status = lc($1);
} elsif (/Specialty<\/TH><TD>(.*?)\sMagic/) {
$color = $colors{$1};
} elsif (/Ranking<\/TH><TD>(.*?)<\/TD>/) {
$rank = $1;
$rank =~ s/,//g;
} elsif (/Power<\/TH><TD>(.*?)<\/TD>/) {
$power = $1;
$power =~ s/,//g;
} elsif (/Total\sland<\/TH><TD>(.*?)\sAcres/) {
$land = $1;
$land =~ s/,//g;
} elsif (/Fortress<\/TH><TD>(.*?)<\/TD>/) {
$fort = $1;
}
}
$mage{$power}{name} = $name;
$mage{$power}{id} = $id;
$mage{$power}{rank} = $rank;
$mage{$power}{color} = $color;
$mage{$power}{power} = $power;
$mage{$power}{land} = $land;
$mage{$power}{fort} = $fort;
$mage{$power}{status} = $status;
$mage{$power}{info} = $info{$id};
}
}
print <<EOT;
Content-type: text/html
<html>
<head>
<title>$title Members</title>
</head>
<body bgcolor="#cfcfc0" text="#000000" link="#000000" vlink="#000000" alink="#000000">
<center>
$extra_head<br>
<u><h2>$title Members</h2></u>
<br>
<table border=1 cellpadding=5 cellspacing=0 width="100%"><tr><td>
<table border=0 cellpadding=5 cellspacing=0 width="100%">
<tr>
<td>List<br>rank</td>
<td>Mage<br>click to<br>see info</td>
<td align="right">Rank</td>
<td>Color</td>
<td align="right">Net<br>Power</td>
<td align="right">Land</td>
<td align="right">Forts</td>
<td>Status</td>
<td>Extra Info<br>click to<br>archmail</td>
</tr>
EOT
foreach $n (sort mysort %mage) {
$name = $mage{$n}{name};
$id = $mage{$n}{id};
$rank = $mage{$n}{rank};
$color = $mage{$n}{color};
$power = $mage{$n}{power};
$land = $mage{$n}{land};
$fort = $mage{$n}{fort};
$status = $mage{$n}{status};
$info = $mage{$n}{info};
if ($name) {
$listrank++;
if ($row == 0) { print "<tr bgcolor=\"cfcfc0\">\n"; $row = 1; } else { print "<tr bgcolor=\"cfcfc0\">\n"; $row = 0; }
print <<EOT;
<td>$listrank</td>
<td><a href="target.cgi?server=$server&ids=$id" target="_blank">$name (#$id)</a></td>
<td align="right">$rank</td>
<td>$color</td>
<td align="right">$power</td>
<td align="right">$land</td>
<td align="right">$fort</td>
<td>$status</td>
<td><a href="
http://$subServers{$server}.magewar.com/archmage/arrow.html?target=$id" target="_blank">$info</a></td>
</tr>
EOT
}
}
print <<EOT;
</table>
</td></tr></table>
<br>
<a href="members_edit.cgi">Edit members list</a>
<br><br>
</form>
</center>
</body>
</html>
EOT