Created
September 10, 2017 10:21
-
-
Save RekcahA/4e6226be4ad8900cfb533fe4fac0aa2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello | |
I am rekcahA | |
Today I want to introduce a very attractive and lovely algorithm | |
This algorithm can simply calculate your age by year and does not require any specific knowledge. | |
To use this age calculation algorithm, you need to have a host or a simulator, such as vamp and ... | |
If you have any comments on this algorithm, I'd be happy to let you know. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><head><meta charset="UTF-8"></head> | |
<body> | |
<?php | |
if(isset($_POST["btn"])) { | |
$y = $_POST["year"]; | |
$m = $_POST["Month"]; | |
$d = $_POST["Day"]; | |
if (empty($y)) { | |
echo "<font color='#ff2828' size='5'>Please enter your year of birth</font>" . "<br>"; | |
} | |
if (empty($m)) { | |
echo "<font color='#ff2828' size='5'>Please enter your month of birth</font>" . "<br>"; | |
} | |
if (empty($d)) { | |
echo "<font color='#ff2828' size='5'>Please enter your day of birth</font>" . "<br>"; | |
} | |
else{ | |
$date = date("Y-m-d"); | |
$array = explode("-", $date); | |
$ss = 0; | |
$day = $array[2] - $d - $ss; | |
if ($day < 0) { | |
$ss = 1; | |
$day = 30 + $day; | |
} | |
$sd = 0; | |
$month = $array[1] - $m - $ss; | |
if ($month < 0) { | |
$sd = 1; | |
$month = 12 + $month; | |
} | |
$year = $array[0] - $y - $sd; | |
echo "<font color='#ffd700' size='4'>" . "Your age :" . "</font>" . "<br>"; | |
echo $year . " year" . "<br>"; | |
echo $month . " month" . "<br>"; | |
echo $day . " day" . "<br>"; | |
} | |
if ($year < 0){echo "Error";} | |
} | |
?> | |
<form method="post"> | |
<font color="#adff2f" size="6">Comprehensive age calculation system</font><br><br> | |
<font color="#ff2828" size="3">Please note that all boxes must be filled in numerically and in the form</font> | |
<br><br><br> | |
Year of Birth : <input type="text" name="year" value="<?php if(isset($ey)) echo $ey; ?>"><br><br> | |
Month of Birth : <input type="text" name="Month" value="<?php if(isset($em)) echo $em; ?>"><br><br> | |
Day of Birth : <input type="text" name="Day" value="<?php if(isset($ed)) echo $ed; ?>"><br><br> | |
<input type="submit" name="btn" value="Calculate my age"> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment