Skip to content

Instantly share code, notes, and snippets.

@mkroman
Forked from anonymous/gist:1043401
Created June 23, 2011 19:28
Show Gist options
  • Save mkroman/1043410 to your computer and use it in GitHub Desktop.
Save mkroman/1043410 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache" />
<META HTTP-EQUIV="Content-Language" CONTENT="da" />
<META HTTP-EQUIV="Content-Type" content="text/html;charset=ISO-8859-1" />
</head>
<body>
<!--<div align="right">
<a href="calc.php?lang=dk"><img src="dk.png" border="0px"></a>
<a href="calc.php?lang=us"><img src="us.png" border="0px"></a>
<a href="calc.php?lang=uk"><img src="uk.png" border="0px"></a>
</div>-->
<center><h3>Beregn din profit ved bitcoin mining!</h3>
<br>
<div style="width:500px;padding:10px;border:1px dashed black;">
<form action="calc.php" method="post">
Btc > $: <input type=text name=dollar value="<?= $_POST["dollar"] ?>" size="5"> $/BTC<br>
$ > dkk: <input type=text name=kr value="<?= $_POST["kr"] ?>" size="5"> DKK/$<br>
Elpris: <input type=text name=kwh value="<?= $_POST["kwh"] ?>" size="5"> DKK<br>
Skat: <input type=text name=tax value="<?= $_POST["tax"] ?>" size="1"> %<br>
Difficulty: <input type=text name=diff value=877000 size="5"><br><br>
<!-- Rig tabel -->
<table width="450px">
<tr>
<td></td><td>Hashrate (mhash/s)</td><td>Elforbrug (watt)</td>
</tr>
<td><b>Rig 1: </b></td>
<td><input type=text name=hashrate1 size="14"></td>
<td><input type=text name=power1 size="12"></td>
</td>
</tr>
</table>
<br>
<input type=submit value="Beregn">
</form>
</div>
<br><br>
<b>Udgifter</b><br>
<div style="width:500px;padding:10px;border:1px dashed black;">
<?
//Sæt form variabler
$hashrate1 = $_POST['hashrate1'];
$power1 = $_POST['power1'];
$diff = $_POST['diff'];
$dollar = $_POST['dollar'];
$kwh = $_POST['kwh'];
$kr = $_POST['kr'];
$tax = $_POST['tax'];
//Variabler og udregninger
$hashratet=$hashrate1;//+$hashrate2+$hashrate3+$hashrate4;
$powert=$power1;//+$power2+$power3+$power4;
$value=2.69595e067;
$btcblock=50;
$blocksec=($value/$diff)*($hashratet*pow(10,6))/pow(2,256);
$btcday=$blocksec*3600*24*$btcblock;
$dollarday=$btcday*$dollar;
$krday=$dollarday*$kr;
$btcday_format = number_format($btcday, 2, '.', '');
$dollarday_format = number_format($dollarday, 2, '.', ',');
$krday_format = number_format($krday, 2, '.', ',');
$eludgift=($powert*$kwh*24)/1000;
$kwht=($powert*24)/1000;
$skatudgift=($krday_format/100)*$tax;
$udgift=$eludgift+$skatudgift;
$profitdk=$krday_format-$udgift;
//Udgifter
//if (($kwht>0) && ($kwh>0)) {
//echo "Elforbrug: $kwht kWh om dagen ved $kwh dkk/kWh.<br>";
//} else {
//echo "Elforbrug: 0 kWh om dagen ved 0 dkk/kWh.<br>";
//}
if ($eludgift>0) {
echo "El: $eludgift dkk om dagen.<br>";
} else {
echo "El er ikke med i beregningen.<br>";
}
if ($skatudgift>0) {
echo "Skat: $skatudgift dkk om dagen.<br><br><br>";
} else {
echo "Skat er ikke med i beregningen.<br><br>";
}
if ($udgift>0) {
echo "Samlet udgift: $udgift dkk om dagen.";
} else {
echo "Udgifter er ikke med i beregningen.";
}
?>
</div>
<br>
<div style="width:500px;padding:10px;border:1px dashed black;">
<?
//Results
echo "Forventet indtjening: $btcday_format btc om dagen.<br>";
echo "Ved den angivne kurs svarer det til $dollarday_format \$ eller $krday_format dkk om dagen.";
if ($hashratet>0) {
echo "<br><br>Samlet hashrate: $hashratet mhash/s.";
} else {
echo "<br><br>Samlet hashrate: 0 mhash/s.";
}
if ($powert>0) {
echo "<br>Samlet elforbrug: $powert watt.";
} else {
echo "<br>Samlet elforbrug: 0 watt.";
}
echo "<br><br>";
if ($profitdk>0) {
echo "<b>Din profit er $profitdk dkk om dagen!</b>";
} else {
echo "<b><font color='red'>Din profit er $profitdk dkk om dagen!</font></b>";
}
?>
</div>
</center>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment