<?
//Don't try to connect if Sent by Referer connection already made
if (!(isset($HTTP_GET_VARS['REFERER'])))
{
include_once('/home/webuser/html/catalog/ldstoreadmin/includes/configure.php');
include_once('/home/webuser/html/catalog/ldstoreadmin/includes/functions/ld_database.php');
ld_tep_db_connect() or die('Unable to connect to database server!');
}

//Loads Current Quotes
$daily_quote_query = ld_tep_db_query("select silver, silver_la, silver_lm, silver_base, gold, gold_la, gold_lm, gold_base, daily_quote_lastupdate from daily_quote where daily_quote_id = 1");
$daily_quote_results = ld_tep_db_fetch_array($daily_quote_query);

$sSpot = $daily_quote_results['silver'];
$sLAPrice = $daily_quote_results['silver_la'];
$sLMPrice = $daily_quote_results['silver_lm'];
$sBase = $daily_quote_results['silver_base'];
$gSpot = $daily_quote_results['gold'];
$gLAPrice = $daily_quote_results['gold_la'];
$gLMPrice = $daily_quote_results['gold_lm'];
$gBase = $daily_quote_results['gold_base'];
$LastUpdate = $daily_quote_results['daily_quote_lastupdate'];

$aRate = round( ($sLAPrice / $sBase), 4);
$mRate = round( ($sLMPrice / $sBase), 4);

$aCom = (1 - $aRate) * 100;
$mCom = (1 - $mRate) * 100;

$FRNconvert = round( ((($sSpot + 3) * .95) / $sBase), 3);
//$FRNconvert = ((($sSpot + 3) * .95) / $sBase);

//Outputs Price Info
?>
<div align="center" style="font-family: Arial, Helvetica, sans-serif; color: #990000; border-style: solid; border-color: #9F0000; border-width: 2px;">
<?
print "<center><b>DAILY COMMISSION RATE</b><br>";
print "<font size=\"-2\">Silver Spot \$" . $sSpot . "<br>";
print "Updated: " . date('m/d/y H:i T', strtotime($LastUpdate)) . "<br>";
print "Associate Commission " . $aCom  . "%<br>";
print "Merchant Commission " . $mCom . "%<br>";
print '<u><a style="color: #990000; text-decoration: none;" href="http://www.libertydollar.org/ld/faqs/convertibility.htm">Exchange Rate ALD to USD</a></u> $' . $FRNconvert . "<br></center></font>";


//print "Gold Spot .\$" . $gSpot . "<br>";
//print "$" . $gBase . " Gold Associate Quote \$" . $gLAPrice . "<br>";
//print "$" . $gBase . " Gold Merchants Quote \$" . $gLMPrice . "<br>";


?>
