This repository has been archived by the owner on May 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofitCalc.php
executable file
·58 lines (50 loc) · 1.8 KB
/
profitCalc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
$json = file_get_contents('http://stats.foldingcoin.net/platformReports/FLDC/profitabilityData.json');
$obj = json_decode($json);
$avgFldc = number_format((float)$obj->{'fldcPerDay'}/$obj->{'credits'}, 8, '.', '');
?>
<html>
<script language=JavaScript>
function profit() {
var fahPPD = document.calc.fahPPD.value;
var avgFLDC = document.calc.avgFLDC.value;
var fldcPrice = document.calc.fldcPrice.value;
var btcPrice = document.calc.btcPrice.value;
var result1 = fahPPD*avgFLDC;
var result2 = result1.toFixed(8);
var result3 = fahPPD*avgFLDC*fldcPrice;
var result4 = result3.toFixed(8);
var result5 = result4*btcPrice;
document.getElementById("fldcPerDay").innerHTML = result2
document.getElementById("btcPerDay").innerHTML = result4
document.getElementById("usdPerDay").innerHTML = '$'+result5.toFixed(2)
}
//-->
</script>
<form name="calc" method="post">
<table cellSpacing="1" cellPadding="1" border="0">
<tr>
<td>Your estimated FAH PPD:</td><td><input size='10' name='fahPPD'></td>
</tr>
<tr>
<td>FLDC Per FAH Credit:</td><td><input size='10' name='avgFLDC' value='<?php echo $avgFldc;?>'></td>
</tr>
<tr>
<td>FLDC/BTC Price:</td><td><input size='10' name='fldcPrice' value='<?php echo $obj->{'fldcPrice'}; ?>'></td>
</tr>
<tr>
<td>BTC/USD Price:</td><td>$<input size='10' name='btcPrice' value='<?php echo $obj->{'btcPrice'};?>'></td>
<tr>
<td>FLDC Per Day:</td><td> <b id='fldcPerDay'></b></td>
</tr>
<tr>
<td>BTC Per Day:</td><td> <b id='btcPerDay'></b></td>
</tr>
<tr>
<td>USD Per Day:</td><td> <b id='usdPerDay'></b></td>
<tr>
<td><input onclick='profit()' type='button' value='Calculate'><input onclick='this.form.reset();' type='button' value='Reset Prices'></td>
</tr>
</table>
</form>
</html>