Permalink
Browse files

First commit: Basic calculator and basic code

Did this in a couple of hours. No approximation. No error fix in case of
text inputted. It's very basic.
  • Loading branch information...
thehowl committed Feb 15, 2014
0 parents commit af01ec08f72a24c3fed96a5e7a14a972395299fb
Showing with 44 additions and 0 deletions.
  1. +31 −0 calc.php
  2. +3 −0 form.php
  3. +10 −0 index.php
@@ -0,0 +1,31 @@
<?
$level = $_POST["leveltoreach"];
if ($level<="100")
{
if ($level>="2") // This because if the value is 0 or 1, or any other value, it creates an error
{ $part = 4 * bcpow($level, 3, 0) - 3 * bcpow($level, 2, 0) - $level;
$resultfinal = 5000 / 3 * $part + 1.25 * bcpow(1.8, $level - 60, 0);
}
else
{ $resultfinal = "0";
}
}
elseif ($level>="101")
{
$part = $level - 100;
$resultfinal = 26931190829 + 100000000000 * $part;
}
else
{
$resultfinal = "error";
};
?>
<!DOCTYPE html>
<html>
<head>
<title>Results</title>
</head>
<body>
Here's the result: <? echo $resultfinal ?>.<br><br>Do it again!<br><? require 'form.php' ?>
</body>
</html>
@@ -0,0 +1,3 @@
<form action="calc.php" method="post">
Level you want to reach: <input type="text" name="leveltoreach"> <input type="submit">
</form>
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title>How much score do you need for the next level?</title>
</head>
<body>
How much score do you need for the next level on Osu!?<br>
<? require 'form.php' ?>
</body>
</html>

0 comments on commit af01ec0

Please sign in to comment.