And a late thank-you to Paul-ish for seeing a detail I didn't see
Calc URL: http://www.calc.streamdown.net
Source:
<?php
$a = $HTTP_GET_VARS['a'];
$b = $HTTP_GET_VARS['b'];
$c = $HTTP_GET_VARS['c'];
$d = $HTTP_GET_VARS['d'];
$e = $HTTP_GET_VARS['e'];
$f = $HTTP_GET_VARS['f'];
$p = $HTTP_GET_VARS['p'];
if ($a == '') { $a = '0'; }
if ($b == '') { $b = '0'; }
if ($c == '') { $c = '0'; }
if ($d == '') { $d = '0'; }
if ($e == '') { $e = '0'; }
if ($f == '') { $f = '0'; }
if ($p == '') { $p = '0'; }
$title = "Pookie's TGW Calculator";
$nav = "<a href='?p=0'>Calculator Home</a> | <a href='?p=donate'>Donate</a> | <a href='?p=about'>About</a> | <small>(<a href='admin' target='_blank'>Admin Panel</a>)</small>";
$fname = "index.php";
$version = "2.0.3";
$release = "21st of June 2006";
$disclaimer = "Property of Jason Lambert (Agapooka)<br />Pookie TGW Calculator version ".$version.", released on the ".$release."."; [/color]
$filename = //well, you don't need to know this part
$announce = //well, you don't need to know this part
{
$lines = file($filename);
$disabled = $lines[0];
}
if ($disabled == 1)
{
$status = " disabled='disabled'";
$why = "<b>".$lines[1]."</b><br /><br />";
$n = '0';
}
else
{
$status = "";
$why = "";
$n = '1';
}
{
$lines = file($announce);
$message = $lines[1];
}
for ($ia=0; $ia<=8; $ia++) {
if ($ia == $p)
{
$sel[$ia] = " selected";
}
else
{
$sel[$ia] = "";
}
}
$head = "<html>
<title>".$title."</title>
<head><center>
<h1>".$title."</h1><br />
".$nav."
</center></head>
<style type='text/css'>
a:link { color: darkblue; text-decoration: none }
a:active { color: darkblue; text-decoration: none }
a:visited { color: darkblue; text-decoration: none }
a:hover { color: darkred; text-decoration: underline }
</style>";
$body = "<body><center>
<table width=500 cellspacing=3 cellpadding=3 border=1>";
$tbl0 = "<tr><td width=100%><center>
<form action='".$fname."' method=get>
";
$frma = "Current: <input size=8 maxlength=22".$status." value=".$a." name=a />
<br />";
$frmb = "Desired: <input size=8 maxlength=22".$status." value=".$b." name=b />
<br />";
$frmc = "<input size=8 maxlength=22".$status." value=".$c." name=c />
<br />";
$frmd = "<select name='d'".$status.">
<option value='0'>DefCon Level:</option>
<option value='1'>None</option>
<option value='1.45'>Unsure</option>
<option value='2'>Critical</option></select>
<br />";
$frme = "<input size=8 maxlength=22".$status." value=".$e." name=e />
<br />";
$frmf = "<input size=8 maxlength=22".$status." value=".$f." name=f />
<br />";
$frmp = "
<h3><b>".$message."</b></h3>
".$why."
<select name='p'>
<option value=0".$sel[0].">Calculate:</option>
<option value=1".$sel[1].">Unit Production Cost</option>
<option value=2".$sel[2].">Ascended Fleet Cost</option>
<option value=3".$sel[3].">MS Weapon Capacity and Weapon Cost</option>
<option value=4".$sel[4].">MS Shield Capacity and Shield Cost</option>
<option value=8".$sel[8].">Fleet (and soon fleet) Hangar Cost</option>
<option value=5".$sel[5].">Spy Levels</option>
<option value=6".$sel[6].">Sabotage</option>
<option value=7".$sel[7].">Planets (coming soon!)</option>
</select>";
$frm0 = "
<input type=submit value='GO!' />
<br />";
$foot = "</form>
</center></td>
</tr></table>
<small>
".$disclaimer."
</small><br /><br />
<img src='/cgi-sys/Count.cgi?df=jason.dat|display=Counter|ft=2|md=6|frgb=100;139;216|dd=E' /><small>  page views since 00:00 GMT on July 14th 2006</small>
<table width=402 border=0 cellspacing=1 cellpadding=1><tr><td>
<br /><small>Sponsored by:<small><br /></td></tr></table>
<table width=402 border=1 bordercolor=#000000 cellspacing=1 cellpadding=1><tr><td>
<center><a href='http://dreadlords.jconserv.net' target='_blank'><img src='ads/dreadlords.gif' alt='Check out the Dread Lords alliance!' /></a><br />+<br />
<a href='http://s11.invisionfree.com/law7441/index.php' target='_blank'><img src='ads/ufor.jpg' alt='Check out the United Federation of Races!' /></a>
</center>
</td></tr><table>
</center></body>
</html>";
if ($p == '0')
{
echo $head,$body,$tbl0."<input type='hidden' value=".$c." name=c />".$frmp,$frm0,$foot;
}
if ($p == '1')
{
$currency = "Naquadah";
$ans = (-1*($a-$b)/3)*((15000*(($b-1)/3)+15000*(($a+2)/3))/2);
$answ = "<br />Cost: ".number_format($n*$ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frma,$frmb."<input type='hidden' value=".$c." name=c />".$frmp,$frm0,$answ,$foot;
}
if ($p == '2')
{
$currency = "Dark Matter Units";
$ans = (-1*($a-$b))*(((5000*($b-1)+5000*($a+4))/2));
$answ = "<br />Cost: ".number_format($n*$ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frma,$frmb."<input type='hidden' value=".$c." name=c />".$frmp,$frm0,$answ,$foot;
}
if ($p == '3')
{
$currency = "Naquadah";
$ans = (-1*($a-$b))*(((10000*($b-1)+10000*($a+2))/2));
$answ = "<br />Cost: ".number_format($n*$ans, 0, '.', ',')." ".$currency."<br />Cost with weapons included: ".number_format($n*$ans+(($b-$a)*2100800), 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frma,$frmb."<input type='hidden' value=".$c." name=c />".$frmp,$frm0,$answ,$foot;
}
if ($p == '4')
{
$currency = "Naquadah";
$ans = (-1*($a-$b))*(((12000*($b-1)+12000*($a+(10/12)))/2));
$answ = "<br />Cost: ".number_format($n*$ans, 0, '.', ',')." ".$currency."<br />Cost with shields included: ".number_format($n*$ans+(($b-$a)*2250000), 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frma,$frmb."<input type='hidden' value=".$c." name=c />".$frmp,$frm0,$answ,$foot;
}
if ($p == '8')
{
$currency = "Naquadah";
$ans = (-1*($a-$b))*(((10000*($b-1)+10000*($a+2))/2));
$answ = "<br />Cost: ".number_format($n*$ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frma,$frmb."<input type='hidden' value=".$c." name=c />".$frmp,$frm0,$answ,$foot;
}
if ($p == '5')
{
$currency = "Naquadah";
$ans = (6000*pow(2,($c-1)));
$answ = "<br />Cost: ".number_format($n*$ans, 0, '.', ',')." ".$currency."<br />Cost for Replicators: ".number_format($n*0.9*$ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0,$frmc,$frmp,$frm0,$answ,$foot;
}
if ($p == '6')
{
$currency = "spies must be sent";
$ans = str_replace(",", "", $d)*(1.01*(str_replace(",", "", $e)/((str_replace(",", "", $f)+1)/(str_replace(",", "", $c)+1)))+1);
$answ = "<br />".number_format($n*$ans, 0, '.', ',')." ".$currency;
echo $head,$body,$tbl0."Enemy covert action: ".$frme."(<b>NOT</b> SPY LEVEL)<br />Your covert action: ".$frmf."(<b>NOT</b> SPY LEVEL)<br />How many spies you have:".$frmc."Enemy's DefCon level:".$frmd.$frmp,$frm0,$answ."<br /><br /><small>*Please remember to exclude any commas from any fields. They are parsed as decimals. I might change this in the future, but this seems to be the default option for now.</small>".$foot;
}
if ($p == '7')
{
echo $head,$body,$tbl0,$frmp,$frm0."<br /><br />Coming when they are updated and actually useful! <img src='http://www.jason.streamdown.net/icon_razz.gif' alt=':-P' />".$foot;
}
if ($p == 'donate')
{
echo $head,$body,$tbl0."<b><u>Feel free to donate ingame resources to Agapooka (10649)</u></b>
<br />If you are signed into <b><i>www</i></b>.stargatewar<b><i>s</i></b>.com (note the 'www' and the 's'), and have Supporter Status, you can do this from here! Note, however, that giving is not obligatory.
<br /><br />
//well, you don't need to know this part
<br /><br />
Your gifts are appreciated!
".$foot;
}
if ($p == 'about')
{
echo $head,$body,$tbl0."<p align='justify'>Pookie's TGW Calculator is made in Agapooka's spare time. It was made for fun, and I hope that you enjoy using it as much as I enjoyed making it! :)</p>".$foot;
}
?>
-Pooka









