<? function printStatsBar () {     global $users$uera$config$cterms; ?> <script type="text/javascript">   var _gaq = _gaq || [];   _gaq.push(['_setAccount', 'UA-2862472-2']);   _gaq.push(['_trackPageview']);   (function() {     var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;     ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);   })(); </script> <!-- and here come's the health circle, lookit it go! --> <? // first I look at what their health is at, which adjusts the BG height and text colour. if ($users[health] >= '100')      $circlebg '0';  elseif ($users[health] >= '90'){     $circlebg '-90';     $hcolour '74e56e';} elseif ($users[health] >= '80'){     $circlebg '-180';     $hcolour '97d868';} elseif ($users[health] >= '70'){     $circlebg '-270';     $hcolour 'b9ca61';} elseif ($users[health] >= '60'){     $circlebg '-360';     $hcolour 'dcbd5b';} elseif ($users[health] >= '50'){     $circlebg '-450';     $hcolour 'ffb055';} elseif ($users[health] >= '40'){     $circlebg '-540';     $hcolour 'ffa155';} elseif ($users[health] >= '30'){     $circlebg '-630';     $hcolour 'ff9255';} elseif ($users[health] >= '20'){     $circlebg '-720';     $hcolour 'ff7455';} elseif ($users[health] >= '10'){     $circlebg '-810';     $hcolour 'ff6555';} else {     $circlebg '-900';     $hcolour 'a6291c'; } ?> <!-- Then I render the circle, indeed it is magical! --> <div id="health-circle" style="background-position: 0 <? echo $circlebg?>px"> <?     if ($users[health] < '100')         echo '             <div id="low-health"><span style="color:#'$hcolour'">'$users[health], '%</span></div>';     else         echo '             <div id="rank">Rank<span id="ranking"><br>'$users[rank], '</span></div>'; ?> </div> <div id="statsbar">     <ul id="stat-list">         <li class="stat" id="turns"><span><?=ucfirst($cterms[turns])?></span><?=$users[turns]?></li>         <li class="stat" id="cash"><span><?=$cterms[cash]?></span>$<?=commas($users[cash])?></li>         <li class="stat" id="food"><span><?=$uera[food]?></span><?=commas($users[food])?></li>         <li class="stat" id="land"><span><?=$cterms[land]?></span><?=commas($users[land])?></li>         <li class="stat" id="loyalty"><span><?=$uera[runes]?></span><?=commas($users[runes])?></li>         <li class="stat" id="workers"><span><?= $uera[peasants?></span><?= commas($users[peasants]) ?></li>     </ul> </div> <!-- <table id="statsbar" style="width:100%"> <tr class="era<?=$users[era]?>" style="font-size:medium">     <td class="acenter st1"><span class="stat st1"><a href="<?=$config[main]?>?action=messages"><?if (numNewMessages() > 0) print "<b>New Mail!</b>"; else print "Mailbox";?></a>     <? if(($users[clan]) && ($users[forum_posts] < numClanPosts())) { ?>     <br><div style="font-size:0.8em;font-weight:bold;"><a href="<?=$config[main]?>?action=clanmsg">New Forum Posts!</a></div>     <? ?></span>     </td>     <td class="acenter st2"><span class="statth st2"><?=ucfirst($cterms[turns])?>: </span><span class="stat st2"><?=$users[turns]?><? if ($users[turnsused] < $config[protection]) print "<div style=\"font-size: 0.8em\">Protection: ".($config[protection]-$users[turnsused])."</div>";?></span></td>     <td class="acenter st3"><span class="statth st3"><?=$cterms[cash]?>: </span><span class="stat st3">$<?=commas($users[cash])?></span></td>     <td class="acenter st4"><span class="statth st4"><?=$cterms[land]?>: </span><span class="stat st4"><?=commas($users[land])?></span></td>     <td class="acenter st5"><span class="statth st5"><?=$uera[runes]?>: </span><span class="stat st5"><?=commas($users[runes])?></span></td>     <td class="acenter st6"><span class="statth st6"><?=$uera[food]?>: </span><span class="stat st6"><?=commas($users[food])?></span></td>     <td class="acenter st7"><span class="statth st7"><?=$cterms[health]?>: </span><span class="stat st7"><?=$users[health]?>%</span></td>          <td class="acenter st6"><span class="statth st6"><?= $uera[peasants?>: </span><span class="stat st7"><?= glink("Population"?><?= commas($users[peasants]) ?></span></td>          <td class="acenter st8"><span class="statth st8">Networth: </span><span class="stat st8">$<?=commas($users[networth])?></span></td></tr> </table> --> <? } // Here is the turn use part function printTurnTable($turnout) {     global $uera$users$cterms$tplst$trplst$prdlst;     ?> <div id="turn-use">     <table id="turn-use-table" class="empstatus">         <? if ($turnout[turnsinside] > 0) {?>         <tr class="inputtable">             <th class="special" colspan=3><b><?=ucfirst($cterms[turns])?> Included: <?=$turnout[turnsinside]?></b></th>         </tr>         <? ?>         <tr><td id="economic" class="turn-table-td"><table>             <tr class="inputtable"><th colspan="2">Economic Status</th></tr>             <tr><th>Income:</th>                 <td>$<?=commas($turnout[income])?></td></tr>             <tr><th>Expenses:</th>                 <td>$<?=commas($turnout[expenses])?></td></tr>             <tr><th>War Tax:</th>                 <td>$<?=commas($turnout[wartax])?></td></tr>             <tr><th>Loan Pay:</th>                 <td>$<?=commas($turnout[loanpayed])?></td></tr>             <!--Storehouse-->             <? if ($users[clan] && $turnout[storemoney] != 0) {?>             <tr><th>Clan:</th>                 <td>$<?=commas($turnout[storemoney])?></td></tr>             <?}?>             <!--Storehouse-->             <tr><th>Net:</th>                 <td><?printCNum($turnout[money],"$",0);?></td></tr>             </table></td>             <td id="food-status" class="turn-table-td"><table>             <?             reset($prdlst);             while (list($key,$val) = each($prdlst)) {             ?>             <tr class="inputtable"><th colspan="2"><?=ucfirst($uera[$val])?> Status</th></tr>             <tr><th>Produced:</th>                 <td><?=commas($turnout["$val"."pro"])?></td></tr>             <tr><th>Consumed:</th>                 <td><?=commas($turnout["$val"."con"])?></td></tr>             <!--Storehouse-->             <? if ($users[clan] && $turnout[storefood] != 0) {?>             <tr><th>Clan:</th>                 <td><?=commas($turnout[storefood])?></td></tr>             <?}?>             <!--Storehouse-->             <tr><th>Net:</th>                 <td><?printCNum($turnout[$val],"",0);?></td></tr>             <?             }             ?>             </table></td>             <td id="worker-army" class="turn-table-td"><table>             <tr class="inputtable"><th colspan="2"><?=$uera[peasants]?> and <?=ucfirst($cterms[army])?> Status</th></tr>             <tr><th>Recruited <?=$uera[peasants]?>:</th>                 <td><?printCNum($turnout[tmppeasants],"",0);?></td></tr>             <tr><th>New <?=$uera[peasants]?>:</th>                 <td><?printCNum($turnout[peasants],"",0);?></td></tr>             <tr><th><?=$uera[wizards]?>:</th>                 <td><?printCNum($turnout[wizards],"",0);?></td></tr>             <tr><th><?=$uera[runes]?>:</th>                 <td><?printCNum($turnout[runes],"",0);?></td></tr>             <?             reset($trplst);             while (list($key,$val) = each($trplst)) {                 ?>             <tr><th><?=$uera[$val]?>:</th>                 <td><?printCNum($turnout[$val],"",0);?></td></tr>             <?         }             ?>             </table></td></tr>     </table>     <?     if (($users[tax] < 20) && ($turnout[peasants] > 0))         {             ?>             <p id="tax-rate" class="main-info"><span class="cgood">Your low tax rate is encouraging <?=$uera[peasants]?> to join your cause.</span></p>             <?         }         ?> </div> <? } function TheEnd ($reason)    // End current action {     global $users$config$version$action$users;     if ($reason != "") { ?> <div class="game-page-head"><h1>Something Has Occurred</h1></div> <div class="game-page" id="occurred-page"> <?=$reason?> </div> <!-- game-page ends --> <div id="game-page-footer"></div> <?     }     if (($users[num]) && ($reason == "") && ($users[tips] == 0)) {         ?>         <div id="tips">             <h3>Tip</h3>             <iframe src="lhelp.php?page=<?=$action?>" name="lhelp">                 [Your browser does not support frames, so you cannot use the tool tips and glossary this way, but you can still read everything through the regular help system]             </iframe>         </div>         <?     }     if ($users[num])         printStatsBar(); ?> <div id="footer-creds"> <a href="http://www.promisance.com" target="_blank">Promisance</a>&trade; v4.1 - Copyright &copy; 1999-2002 PC Purgett<br> <a href="http://www.qmtpro.com/" target="_blank">QM Promisance</a>&trade; v3.1 - Copyright &copy; 2001 by <a href="mailto:quietust@ircN.org">The Quietust</a> &amp; <a href="mailto:lord_of_fire1@yahoo.com">Morvandium</a><br> <a href="http://www.redwallwarlords.com/">Redwall: Warlords</a> v3.0 - Copyright &copy; 2002-2014 by the RWL Staff <br> <a href="<?=$config[main]?>?action=credits">-- Full Credits --</a><br> </div> <?     HTMLendfull();     exit; } function printScoreHeader ($color) {         global $users$cterms$theme;?> <tr class="era<?=$color?> scores-head">     <th class="score-col" id="rank-col">&nbsp;</th>     <th class="score-col" id="warlord-col"><?=ucfirst($cterms[warlord])?></th>     <th class="score-col" id="land-col"><?=ucfirst($cterms[land])?></th>     <th class="score-col" id="networth-col">Networth</th>     <? if ($theme[clans]) { ?>     <th class="score-col" id="clan-col"><?=ucfirst($cterms[clan])?></th>     <? ?>     <th class="score-col" id="location-col"><?=ucfirst($cterms[era])?></th>     <th class="score-col" id="race-col">Race</th> </tr> <? } function printScoreLine () {     global $users$enemy$ctags$rtags$etags$racedb$eradb$config$theme;     $mclan loadClan($users[clan]);     $ccolor "";     $color "normal";     if ($enemy[land] == 0)         $color "dead";     elseif ($enemy[disabled] == 2)         $color "admin";     elseif ($enemy[disabled] == 3)         $color "disabled";     elseif ($enemy[vacation] > $config[vacationdelay])         $color "vacation";     elseif ($enemy[turnsused] <= $config[protection])         $color "protected";     if ($theme[clans]) {         if (($users[clan]) && ($enemy[clan] == $users[clan]))             $color "ally";         if ($enemy[clan] == 0) {             $ccolor "";         } else if (($enemy[clan] == $mclan[ally1]) || ($enemy[clan] == $mclan[ally2]) || ($enemy[clan] == $mclan[ally3])) {             $ccolor "<span class=\"mally\">(Ally)</span>";         } else if (($enemy[clan] == $mclan[war1]) || ($enemy[clan] == $mclan[war2]) || ($enemy[clan] == $mclan[war3])) {             $ccolor "<span class=\"mdead\">(War)</span>";         }         $showclan $ctags["$enemy[clan]"]." ".$ccolor;         if ($enemy[clan] > 0)                         $showclan "<a href=\"?action=clancrier&sclan=$enemy[clan]\" class=\"m$color\">".$ctags["$enemy[clan]"]."</a> ".$ccolor;                  }     if ($enemy[num] == $users[num])         $color "self"; ?> <tr class="m<?=$color?> scores-tr">     <td class="score-col" id="rank-col"><?if ($enemy[online]) echo "*";?><?=$enemy[rank]?></td>     <td class="score-col" id="warlord-col">         <? if($theme[emp_tracking])         {             if($enemy[emp] == 1)             {                 ?><img src="images/emp-icon.png"/>&nbsp;<?             }         } ?>         <a href="#" onclick="showhide('scorediv<?=$enemy[num]?>'); return false;"><span class="m<?=$color?>"><?=stripslashes($enemy[empire])?> (#<?=$enemy[num]?>)</span></a>         <?         $days round((time() - $enemy[idle]) / (60 60 24), 0);         $hours round(((time() - $enemy[idle]) % (60 60 24)) / (60 60), 0);         $minutes round((((time() - $enemy[idle]) % (60 60 24)) % (60 60)) / 600);         $defenses $enemy[deftotal] . " (";         if ($enemy[deftotal])             $defenses .= round($enemy[defsucc] / $enemy[deftotal] * 100) . "%)";         else             $defenses .= "0%)";         $offenses $enemy[offtotal] . " (";         if ($enemy[offtotal])             $offenses .= round($enemy[offsucc] / $enemy[offtotal] * 100) . "%)";         else             $offenses .= "0%)";         $pclan loadClan($enemy[clan]);         
        
/*
         * Why are you guys alergic to comments
         * Start of the player description block that comes up when you click a name on scores
         */
         
?>         <div id="scorediv<?=$enemy[num]?>" style="display: none; margin:auto;height:0px;">             <div class="scoreinfo">                 <a id="close-score-pop" class="x-button" href="#" onclick="showhide('scorediv<?=$enemy[num]?>'); return false;">X</a>                 <h3><a href="?action=warlordinfo&warlord=<?=$enemy[num]?>"><?=stripslashes($enemy[empire])?> (#<?=$enemy[num]?>)</a></h3>                 <p class="small-p">Attack Status: <?=getAttackStatus($users$enemy$uclan$pclan)?> <br> Last Online: <?=$days?> days, <?=$hours?> hours, and <?=$minutes?> minutes</p>                 <table class="game-table">                     <tr>                         <th>Offenses</th>                         <th>Defenses</th>                         <th>Cities</th>                         <th>Kills</th>                         <td><a href="<?= $config[main?>?action=military&target=<?= $enemy[num?>">Attack</a></td>                     </tr>                     <tr>                         <td><?=$offenses?></td>                         <td><?=$defenses?></td>                         <td><?=$enemy[cities]?></td>                         <td><?=$enemy[kills]?></td>                         <td><a href="<?= $config[main?>?action=aid&dest=<?= $enemy[num?>">Aid</a></td>                     </tr>                 </table>
                 <? if ($enemy[notice] != ""){ ?>          <div class="game-table" style="max-height:100px;overflow:auto;">                     <table>                         <tr>                             <td><?= nl2br(htmlspecialchars_decode(stripslashes($enemy[notice]))) ?></td>                         </tr>                     </table>                 </div> <?}?>                 <form method="post" class="oldmess" action="<?= $config[main?>?action=messages">                     <div class="messages" id="<?= $newm ?>">                         <h3> Send <?=stripslashes($enemy[empire])?> a message</h3>                         <input type="hidden" name="msg_id" value="<?= $message[id?>">                         <input type="hidden" name="msg_src" value="<?= $message[src?>">                         <div id="reply-to-<?echo $message[id]?>" class="reply-box">                             <form method="post" action="<?= $config[main?>?action=messages">                                 <div>                                     <input type="hidden" name="msg_replyto" value="<?= $msg_id ?>">                                     <input type="hidden" name="msg_dest" value="<?= $enemy[num?>">                                     <textarea class="big-input" name="msg_body"></textarea>                                     <input class="button_submit r-a" type="submit" name="do_message" value="Send Reply to <?= $enemy[empire?> (#<?= $enemy[num?>)">                                 </div>                             </form>                         </div>                     </div>                 </form>                              </div> <!-- scoreinfo div end -->         </div> <!-- end of special show/hide scorediv -->     </td> <!-- end of warlord td -->          <td class="score-col" id="land-col"><?=commas($enemy[land])?></td>     <td class="score-col" id="networth-col">$<?     if($enemy[ability] > && $enemy[race] == 4) {         print commas(getCloakedNetworth($enemy));     }     else         print commas($enemy[networth]);    ?></td>     <? if ($theme[clans]) { ?>     <td class="score-col" id="clan-col"><?=$showclan?></td>     <? ?>     <td class="score-col" id="location-col"><?=$etags["$enemy[era]"]?></td>     <td class="score-col" id="race-col"><?=$rtags["$enemy[race]"]?></td></tr>         <? } function printSearchHeader ($color) {     global $theme$cterms; ?> <tr class="era<?=$color?> scores-head">     <th>Rank</th>     <th><?=ucfirst($cterms[warlord])?></th>     <th><?=ucfirst($cterms[land])?></th>     <th>Networth</th>     <? if ($theme[clans]) { ?>     <th><?=ucfirst($cterms[clan])?></th>     <? ?>     <th >Race</th>     <th><?=ucfirst($cterms[era])?></th>     <th>O</th>     <th>D</th>     <th>K</th></tr> <? } function printSearchLine () {     global $users$enemy$ctags$rtags$etags$racedb$eradb$config$theme;     $color "normal";     if ($enemy[num] == $users[num])         $color "self";     elseif ($enemy[land] == 0)         $color "dead";     elseif ($enemy[disabled] == 2)         $color "admin";     elseif ($enemy[disabled] == 3)         $color "disabled";     elseif ($enemy[vacation] > $config[vacationdelay])         $color "vacation";     elseif ($enemy[turnsused] <= $config[protection])         $color "protected";     elseif (($users[clan]) && ($enemy[clan] == $users[clan]))         $color "ally"; ?> <tr class="m<?=$color?>">     <td class="aright"><?if ($enemy[online]) echo "*";?><?=$enemy[rank]?></td>     <? if ($users[num] > 0) { ?><td><a href="?action=warlordinfo&warlord=<?=$enemy[num]?>">?</a></td><? ?>     <td class="acenter"><?=stripslashes($enemy[empire])?> (#<?=$enemy[num]?>)</td>     <td class="aright"><?=commas($enemy[land])?></td>     <td class="aright">$<?         if($enemy[ability] > && ($enemy[race] == 4)) {             print commas(getCloakedNetworth($enemy));         }         else             print commas($enemy[networth]);     ?></td>     <? if ($theme[clans]) { ?>     <td class="acenter"><?=$ctags["$enemy[clan]"]?></td>     <? ?>     <td class="acenter"><?=$rtags["$enemy[race]"]?></td>     <td class="acenter"><?=$etags["$enemy[era]"]?></td>     <td class="acenter"><?=$enemy[offtotal]?> (<?if ($enemy[offtotal]) echo round($enemy[offsucc]/$enemy[offtotal]*100); else echo 0;?>%)</td>     <td class="acenter"><?=$enemy[deftotal]?> (<?if ($enemy[deftotal]) echo round($enemy[defsucc]/$enemy[deftotal]*100); else echo 0;?>%)</td>     <td class="acenter"><?=$enemy[kills]?></td></tr> <? } function printMainStats ($user$race$era) {     global $config$users$cterms$tplst$trplst$prdlst;     if ($user[ability] > && ($enemy[race] == 4)) {             $minr 1;             $maxr 20;             $user[cash] *= 1-(rand($minr,$maxr)/100)+.1;             $user[food] *= 1-(rand($minr,$maxr)/100)+.1;             $user[networth] *= 1-(rand($minr,$maxr)/100)+.1;             $user[armtrp] *= 1-(rand($minr,$maxr)/100)+.1;             $user[lndtrp] *= 1-(rand($minr,$maxr)/100)+.1;             $user[flytrp] *= 1-(rand($minr,$maxr)/100)+.1;             $user[seatrp] *= 1-(rand($minr,$maxr)/100)+.1;             $user[wizards] *= 1-(rand($minr,$maxr)/100)+.1;     } ?> <h3 class="table-title"><?=stripslashes($user[empire])?> (#<?=$user[num]?>)</h3>  <table id="main-stats" class="game-table">     <tr><td>     <table class="main-table">         <tr><td class="label-td"><?=$cterms[turns]?><?=glink("Turns")?></td><?              ?><td><?=$user[turns]?> (max <?=$config[maxturns]?>)</td></tr>         <tr><td class="label-td"><?=$cterms[turns]?> Stored<?=glink("Turns Stored")?></td><?       ?><td><?=$user[turnsstored]?> (max <?=$config[maxstoredturns]?>)</td></tr>         <tr><td class="label-td">Rank<?=glink("Rank")?></td><?               ?><td>#<?=$user[rank]?></td></tr>         <tr><td class="label-td"><?=$era[peasants]?><?=glink("Workers")?></td><??><td><?=commas($user[peasants])?></td></tr>         <tr><td class="label-td"><?=$cterms[acres]?><?=glink("Land Acres")?></td><?         ?><td><?=commas($user[land])?></td></tr>         <tr><td class="label-td"><?=$cterms[cash]?><?=glink("Money")?></td><?              ?><td>$<?=commas($user[cash])?></td></tr>         <? reset($prdlst); while (list($key,$val) = each($prdlst)) { ?>         <tr><td class="label-td"><?=$era[$val]?><?=glink("$era[$val]")?></td><?    ?><td><?=commas($user[$val])?></td></tr>         <? ?>         <tr><td class="label-td"><?=$era[runes]?><?=glink("Loyalty")?></td><?   ?><td><?=commas($user[runes])?></td></tr>         <tr><td class="label-td">Networth<?=glink("Networth")?></td><?           ?><td>$<?=commas($user[networth])?></td></tr>     </table></td>          <td>     <table class="main-table">         <tr><td class="label-td"><?=ucfirst($cterms[era])?><?=glink("Location")?></td><?               ?><td><?=$era[name]?></td></tr>         <tr><td class="label-td">Race<?=glink("Race")?></td><?              ?><td><?=$race[name]?></td></tr>         <tr><td class="label-td"><?=$cterms[health]?><?=glink("Health")?></td><?            ?><td><?=$user[health]?>%</td></tr>         <tr><td class="label-td">Tax Rate<?=glink("Tax Rate")?></td><?          ?><td><?=$user[tax]?>%</td></tr>         <? reset($trplst);         while (list($key,$val) = each($trplst)) { ?>         <tr><td class="label-td"><?=$era[$val]?><?=glink("$era[val]")?></td><? ?><td><?=commas($user[$val])?></td></tr>         <? ?>         <tr><td class="label-td"><?=$era[wizards]?><?=glink("Leaders")?></td><??><td><?=commas($user[wizards])?></td></tr>     </table></td></tr>     <?     // Custom Fields -------------------------------------------------------------------------     $cfields explode("\n",$users[cfields]);     $count == 0;     for ($i 0$i count($cfields); $i++) {         list ($type,$name,$value,$garbage) = split(";",$cfields[$i],4);         if ($type == "e") {             $vals $value;             $value eregi_replace("$cterms[land]",$user[land],$value);             $value eregi_replace("$cterms[acres]",$user[land],$value);             $value eregi_replace("OffTotal",$user[offtotal],$value);             $value eregi_replace("DefTotal",$user[deftotal],$value);             $value eregi_replace("OffSuccess",$user[offsucc],$value);             $value eregi_replace("DefSuccess",$user[defsucc],$value);             $value eregi_replace("Num$cterms[city]",$user[cities],$value);             $value eregi_replace("Kills",$user[kills],$value);             $value eregi_replace("$cterms[era]",$era[name],$value);             $value eregi_replace("Rank",$user[rank],$value);             $value eregi_replace("Networth",$user[networth],$value);             $value eregi_replace("RaceOffenseBonus",$race[offense],$value);             $value eregi_replace("RaceDefenseBonus",$race[defense],$value);             $value eregi_replace("Race",$race[name],$value);             $value eregi_replace("$cterms[turns]",$user[turns],$value);             $value eregi_replace("$cterms[turns]Stored",$user[turnsstored],$value);             $value eregi_replace("$cterms[cash]",$user[cash],$value);             $value eregi_replace("runes",$user[runes],$value);             $value eregi_replace("$cterms[health]",$user[health],$value);             $value eregi_replace("TaxRate",$user[tax],$value);             reset($tplst);             while (list($key,$val) = each($tplst))                 $value eregi_replace("$val",$user[$val],$value);             $value eregi_replace("wizards",$user[wizards],$value);             $value eregi_replace("peasants",$user[peasants],$value);             $value eregi_replace("mysql","my_sql",$value);             $value eregi_replace("saveuserdata","save_userdata",$value);             $value eregi_replace("saveclandata","save_clandata",$value);             $value preg_replace_callback("|ln\(([0-9]+)\)|","llog",$value);             $value eregi_replace("[ \t\r]","",$value);             $value addslashes($value);             $value ereg_replace("[A-z0-9_][\(]","-",$value);             $value ereg_replace("[\$]","-",$value);             //echo "Evaled code 1: '$value'<BR>";             $val "Error";             @eval("\$val = $value;");             if ((eregi("commas",$garbage)) && ($val != "Error"))                 $val commas(floatval($val));             if ($count == 0)                 echo "<tr class=\"era$user[era]\"><th colspan=\"3\">Custom Fields</th></tr>\n";             echo "<tr>\n    <th style=\"text-align: left\">$name";             if ($users[tips] == 0)                 echo "<a href=\"lhelp.php?page=espionage&fieldname=".urlencode($name)."&equation=".urlencode($vals)."\" style=\"font-weight: normal\" target=\"lhelp\">(?)</a>";             echo "</th>\n    <td></td>\n    <td style=\"text-align: right\">$val</td>\n </tr>\n";             $count++;         }     }     ?> </table> <? } function printNews (&$user) {     global $newsdb$playerdb$clandb$uera$time$config$trplst$prdlst$tplst$cterms;     $news dbquery("SELECT time,num_s,p1.empire AS name_s,c1.name AS clan_s,p1.era AS era_s,num_d,p2.empire AS name_d,c2.name AS clan_d,p2.era AS era_d,event,acres,data,destroyed_towers FROM $newsdb LEFT JOIN $playerdb AS p1 ON (num_s=p1.num) LEFT JOIN $playerdb AS p2 ON (num_d=p2.num) LEFT JOIN $clandb AS c1 ON (clan_s=c1.num) LEFT JOIN $clandb AS c2 ON (clan_d=c2.num) WHERE num_d=$user[num] AND time>$user[newstime] ORDER BY time DESC;");     if (!mysql_num_rows($news))         return 0; ?> <table class="inputtable"> <tr><th>Time</th>     <th colspan="2">Event</th></tr> <?     while ($new mysql_fetch_array($news))     {         $data = array();         $values explode(";",$new[data]);         while (list($key,$val) = each($values)) {             list($key,$val) = split(":",$val,2);             $data[$key] = $val;     } ?> <tr style="vertical-align:top"><th><?         $hours = ($time-$new[time])/3600;         if ($hours 24)         {             $days floor($hours/24);             print $days." days, ";             $hours -= $days*24;         }         print round($hours,1)." hours ago"; ?></th> <?         if ($new[era_s] > 0)             $eera loadEra($new[era_s]);         switch ($new[event])         {         case 100:             switch ($new[data0])             {             case 1:    $type 'food';        break;             case 2:    $type 'armtrp';    break;             case 3:    $type 'lndtrp';    break;             case 4:    $type 'flytrp';    break;             case 5:    $type 'seatrp';    break;             }         if ($data[commission] < .15){ ?>    <td colspan="2"><span class="cgood">You sold <?=commas($data[amount])?> <?=$uera["$data[type]"]?> on the market for $<?=commas($data[sales])?>.</span><span class="cgood"> The market tax was <?=commas(100*$data[commission])?>%.</span></td></tr> <?            break;         }         else if ($data[commission] < .35){ ?>    <td colspan="2"><span class="cgood">You sold <?=commas($data[amount])?> <?=$uera["$data[type]"]?> on the market for $<?=commas($data[sales])?>.</span><span class="cwarn"> The market tax was <?=commas(100*$data[commission])?>%.</span></td></tr> <?            break;         }         else{ ?>    <td colspan="2"><span class="cgood">You sold <?=commas($data[amount])?> <?=$uera["$data[type]"]?> on the market for $<?=commas($data[sales])?>.</span><span class="cbad"> The market tax was <?=commas(100*$data[commission])?>%.</span></td></tr> <?            break;         }         case 101: ?>    <td colspan="2"><span class="cgood">The winning lottery ticket number is announced. You look at your lottery ticket and it matches! You have won $<?=commas($data[money])?>!</span></td></tr> <?            break;         case 102: ?>    <td><span class="cgood"><?=$new[name_s]?> (#<?=$new[num_s]?>) has sent you <?=commas($data[seatrp])?> <?=$uera[seatrp]?> carrying...</span></td>     <td><?             reset($tplst);             while (list($key,$val) = each($tplst)) {                 if (($val != "seatrp") && ($data[$val] > 0))                     print commas($data[$val]).$uera[$val]<br>\n";             }             if ($data[cash])    print "$".commas($data[cash])."<br>\n";             if ($data[runes])    print commas($data[runes])." Loyalty<br>\n"; ?>    </td></tr> <?            break;         case 103: ?>    <td colspan="2"><span class="cgood">You have won $<?=commas($data[money])?> for winning the <?=$uera[seatrp]?> races.</span></td></tr> <?            break;         case 104: ?>    <td colspan="2"><span class="cgood">You won $<?=commas($data[money])?> off of your bets on the <?=$uera[seatrp]?> races.</span></td></tr> <?            break;         case 107: ?>    <td colspan="2"><span class="cwarn">You have lost your throne as Emperor.</span></td></tr> <?            break;         case 108: ?>    <td colspan="2"><span class="cgood">You have become Emperor.</span></td></tr> <?            break;         case 109: ?>    <td colspan="2"><span class="cwarn">Your request to join <?=$new[clan_d]?> was denied.</span></td></tr> <?            break;         case 110: ?>    <td colspan="2"><span class="cgood">You founded <?=$new[clan_d]?>.</span></td></tr> <?            break;         case 111: ?>    <td colspan="2"><span class="cwarn">You disbanded <?=$new[clan_d]?>.</span></td></tr> <?            break;         case 112: ?>    <td colspan="2"><span class="cgood">You are now a member of <?=$new[clan_d]?></span></td></tr> <?            break;         case 113: ?>    <td colspan="2"><span class="cwarn"><?             if ($new[num_s] == $new[num_d])                 print "You";             else    print "$new[name_s] (#$new[num_s])"; ?> left <?=$new[clan_d]?>.</span></td></tr> <?            break;         case 114: ?>    <td colspan="2"><span class="cwarn"><?=$new[name_s]?> (#<?=$new[num_s]?>) removed you from <?=$new[clan_s]?>.</span></td></tr> <?            break;         case 115: ?>    <td colspan="2"><span class="cgood"><?=$new[name_s]?> (#<?=$new[num_s]?>) made you leader of <?=$new[clan_d]?>.</span></td></tr> <?            break;         case 116: ?>    <td colspan="2"><span class="cgood">You inherited leadership of <?=$new[clan_d]?>.</span></td></tr> <?            break;         case 117: ?>    <td colspan="2"><span class="cwarn"><?=$new[name_s]?> (#<?=$new[num_s]?>) dropped you from the disbanded <?=$new[clan_s]?>.</span></td></tr> <?            break;         case 118: ?>    <td colspan="2"><span class="cgood"><?=$new[name_s]?> (#<?=$new[num_s]?>) made you a diplomat of <?=$new[clan_d]?>.</span></td></tr> <?            break;         case 119: ?>    <td colspan="2"><span class="cwarn"><?=$new[name_s]?> (#<?=$new[num_s]?>) has removed you from your position as a diplomat of <?=$new[clan_d]?>.</span></td></tr> <?            break;         case 201: ?>    <td colspan="2"><span class=<?             if ($data[success] == "no")                 print '"cwarn">'."You find $new[name_s] (#$new[num_s]) attempting to view your army!";             else    print '"cbad">'."You find another warlord viewing your stats!"; ?></span></td></tr> <?            break;         case 202: ?>    <td colspan="2"><span class=<?             if ($data[success] == "no")                 print '"cwarn">'."$new[name_s] (#$new[num_s]) tried to eliminate your forces!";             else             {                 print '"cbad">';                 if ($data[sheild] == "yes")                     print "1";                 else    print "3";                 print "% of your forces were eliminated by $new[name_s] (#$new[num_s])!";             } ?></span></td></tr> <?            break;         case 204: ?>    <td colspan="2"><span class=<?             if ($data[success] == "no")                 print '"cwarn">'."You notice $new[name_s] (#$new[num_s]) trying to poison your food!";             else             {                 print '"cbad">'."Someone has poisoned ".commas($data[food]).$uera[food] and $".commas($data[cash]);                 if ($data[sheild] == "yes")                     print ", though your guards protected most of your goods.";                 else    print "!";             } ?></span></td></tr> <?            break;         case 205: ?>    <td colspan="2"><span class=<?             if ($data[success] == "no")                 print '"cwarn">'."You find $new[name_s] (#$new[num_s]) attempting to disturb your $uera[runes]!";             else             {                 print '"cbad">'."Attackers destroyed ".commas($data[rune])." of your $uera[runes]";                 if ($data[sheild] == "yes")                     print ", though your guards prevented most of the damage.";                 else    print "!";             } ?></span></td></tr> <?            break;        case 206: ?>    <td colspan="2"><span class=<?             if ($data[success] == "no")                 print '"cwarn">'."You find $new[name_s] (#$new[num_s]) attempting to send saboteurs into your empire!";             else             {                 print '"cbad">'."Saboteurs have destroyed part of your infrastructure and damaged your health";                 if ($data[sheild] == "yes")                     print ", though your shield kept most of them out.";                else    print "!";            } ?></span></td></tr> <?            break;         case 209:             ?>    <td colspan="2"><span class="cwarn">You find <?=$new[name_s]?> (#<?=$new[num_s]?>) attempting to take one of your cities!</span></td></tr> <?             break;         case 210:             break;         case 211:             if (($data[success] == "no") && (($data[dloss] > 0) || ($data[aloss] > 0)))             { ?>    <td><span class="cwarn">You find <?=$new[name_s]?> (#<?=$new[num_s]?>) losing a fight with your leaders!</span></td>     <td>You killed <?=$data[aloss]?> <?=$eera[wizards]?>, losing <?=commas($data[dloss])?> <?=$uera[wizards]?> in the process.</td></tr> <?            } elseif ($new[success] == "no")             { ?>    <td colspan="2"><span class="cwarn">You find <?=$new[name_s]?> (#<?=$new[num_s]?>) attempting to fight with your <?=$uera[wizards]?>!</span></td></tr> <?            }             else             { ?>    <td><span class="cbad">Your <?=$uera[wizards]?> were defeated by <?=$new[name_s]?> (#<?=$new[num_s]?>) and you lost <?=$new[acres]?> <?=$cterms[acres]?> of <?=$cterms[land]?>!</span></td>     <td>You lost <?=$data[dloss]?> <?=$uera[wizards]?>, but you managed to kill <?=commas($data[aloss])?> of your attacker's <?=$eera[wizards]?>.</td></tr> <?            }             break;         case 212: ?>    <td colspan="2"><span class=<?             if ($data[success] == "no")                 print '"cwarn">'."You find $new[name_s] (#$new[num_s]) trying to steal your money!";             else             {                 if ($data[money] > 0){                     print '"cbad">'."Someone stole $".commas($data[money]) ." from your treasury";                     if ($data[sheild] == "yes")                         print ", though your guards them from stealing more.";                     else    print "!";                 }                 if ($data[food] > 0){                     print '"cbad">'."Someone stole " .commas($data[food]) ." food from your granaries";                     if ($data[sheild] == "yes")                         print ", though your guards them from stealing more.";                     else    print "!";                 }             } ?></span></td></tr> <?            break;         case 213: ?>    <td colspan="2"><span class="cwarn">You find <?=$new[name_s]?> (#<?=$new[num_s]?>) attempting to open an attack opportunity!</span></td></tr> <?            break;         case 214: ?>    <td colspan="2"><span class="cbad"><?=$new[name_s]?> (#<?=$new[num_s]?>) opened an attack opportunity!</span></td></tr> <?            break;         case 227:         ?>    <td colspan="2"><span class="cwarn">You find <?=$new[name_s]?> (#<?=$new[num_s]?>) attempting to open an attack opportunity!</span></td></tr> <?            break;         case 228:             if ($new[data0] == 0) {                             ?>    <td><span class="cwarn">You find <?=$new[name_s]?> (#<?=$new[num_s]?>) failing to capture one of your cities.</span>             <?                     } else {                             ?>    <td><span class="cbad"><?=$new[name_s]?> (#<?=$new[num_s]?>) has taken one of your cities!</span>             <?                     }?>             </td><td>In the battle, you lost:<BR>             <?                 reset($trplst);                 while (list($key,$val) = each($trplst))                 {                     if($new[$val] > 0)                         echo commas($new[$val]).$uera[$val]<BR>\n";                 }             ?>             <?=commas($data[wizards])?> <?=$uera[wizards]?><BR>             <?=commas($data[peasants])?> <?=$uera[peasants]?>             </td></tr>                     <?                     break;         case 300: ?>    <td colspan="2"><span class="cwarn">Your forces came to the aid of <?=sqleval("SELECT empire FROM $playerdb WHERE num=$data[defender];")?> (#<?=$data[defender]?>) in defense from <?=$new[name_s]?> (#<?=$new[num_s]?>)!</span></td></tr><?            break;         case 301: ?>    <td colspan="2"><span class="cbad">As <?=$new[name_s]?> (#<?=$new[num_s]?>) delivers their final blow, your army collapses...</span></td></tr> <?            break;         case 302:         case 303:         case 304:         case 305:         case 306:         case 307:         case 308: ?>    <td><span class="cbad"><?=$new[name_s]?> (#<?=$new[num_s]?>) attacked you!</span></td>     <td><?             $xlst array_merge($tplst,array("peasants","wizards","cash"));             $uera["cash"] = $cterms[cash];             if ($new[acres] > 0)                 print "Your enemy captured $new[acres] $cterms[acres] of $cterms[land] and destroyed:<br>\n";             else if ($new[acres] < 0)                 print "Your enemy lost ".(-1*$new[acres]).$cterms[acres] of $cterms[land] attempting to attack you, destroying:<br>\n";             else if ($new[destroyed_towers] > 0//PILLAGE KLUDGE                 print "Your enemy destroyed $new[destroyed_towers] towers and you lost:<br>\n";             else    print "You held your defense and your enemy was repelled, but you lost:<br>\n";              reset($xlst);             while (list($key,$val) = each($xlst))                 if ($data["d".$val]) print commas($data["d".$val]).$uera[$val]<br>\n";             print "You managed to destroy:<br>\n";             reset($xlst);             while (list($key,$val) = each($xlst))                 if ($data["o".$val]) print commas($data["o".$val]).$eera[$val]<br>\n"; ?></td></tr> <?            break;         }     } ?> </table> <?     return 1; } function StartStatic() { } function llog($matches) {     echo "FINDING LOG OF $matches[1]<BR>";     return log($matches[1]); } ?>