Forum Moderators: coopster
.calcount
{
width:100%;
border-left-color:#E6E6E6;
border-right-color:#E6E6E6;
border-bottom-color:#E6E6E6;
border-top-color:#E6E6E6;
border-left-style:solid;
border-right-style:solid;
border-bottom-style:solid;
border-top-style:solid;
border-right-width:1px;
border-left-width:1px;
border-bottom-width:1px;
border-top-width:1px;
}
<?
/**
* @package Module Daily Calorie Calculator for Joomla! 1.5
* @version $Id: mod_dailycaloriecalculator.php 599 2010-03-20 23:26:33Z you $
* @author Alex Barr
* @copyright (C) 2010- Alex Barr
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined( '_JEXEC' ) or die( 'Restricted access' );
$age=$_POST["age"];
$gender=$_POST["gender"];
$heightcm=$_POST["heightcm"];
$weightkg=$_POST["weightkg"];
$activity=$_POST["activity"];
if ($heightcm!="" && $weightkg!="" && $age!="" && $gender!="" && $activity!="" ) {
if (is_numeric($age)) {
$age=$age;
} else {
$age=100;
}
//$heightm = $heightcm / 100;
echo "Age, years: ".$age."<br />";
if ($gender=="1") {echo "Gender: Male<br />";}
if ($gender=="2") {echo "Gender: Female<br />";}
echo "Heigth, cm: ".$heightcm."<br />";
echo "Weigth, kg: ".$weightkg."<br />";
if ($activity=="1") {echo "Activity: Sedentary<br />";}
if ($activity=="2") {echo "Activity: Lightly Active<br />";}
if ($activity=="3") {echo "Activity: Moderately Active<br />";}
if ($activity=="4") {echo "Activity: Very Active<br />";}
if ($activity=="5") {echo "Activity: Extra Active<br />";} [edited by: eelixduppy at 12:55 am (utc) on Dec 4, 2011]
[edit reason] removed url [/edit]
<?
/**
* @package Module Daily Calorie Calculator for Joomla! 1.5
* @version $Id: mod_dailycaloriecalculator.php 599 2010-03-20 23:26:33Z you $
* @author Alex Barr
* @copyright (C) 2010- Alex Barr
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined( '_JEXEC' ) or die( 'Restricted access' );
$age=$_POST["age"];
$gender=$_POST["gender"];
$heightcm=$_POST["heightcm"];
$weightkg=$_POST["weightkg"];
$activity=$_POST["activity"];
if ($heightcm!="" && $weightkg!="" && $age!="" && $gender!="" && $activity!="" ) {
if (is_numeric($age)) {
$age=$age;
} else {
$age=100;
}
//$heightm = $heightcm / 100;
echo "Age, years: ".$age."<br />";
if ($gender=="1") {echo "Gender: Male<br />";}
if ($gender=="2") {echo "Gender: Female<br />";}
echo "Heigth, cm: ".$heightcm."<br />";
echo "Weigth, kg: ".$weightkg."<br />";
if ($activity=="1") {echo "Activity: Sedentary<br />";}
if ($activity=="2") {echo "Activity: Lightly Active<br />";}
if ($activity=="3") {echo "Activity: Moderately Active<br />";}
if ($activity=="4") {echo "Activity: Very Active<br />";}
if ($activity=="5") {echo "Activity: Extra Active<br />";}
//BMR Men = 66.5 + (13.75 X weight in kilos) + (5.003 X height in cm) – (6.775 X age in years)
//BMR Women = 655 + (9.6 X weight in kilos) + (1.8 X height in cm) – (4.7 X age in years)
if ($gender=="1") {$bmr=66+(13.7 * $weightkg)+(5 * $heightcm)-(6.8 * $age);}
if ($gender=="2") {$bmr=655.1+(9.563 * $weightkg)+(1.85 * $heightcm)-(4.676 * $age);}
if ($activity=="1") {$bmr=$bmr*1.2;}
if ($activity=="2") {$bmr=$bmr*1.375;}
if ($activity=="3") {$bmr=$bmr*1.55;}
if ($activity=="4") {$bmr=$bmr*1.725;}
if ($activity=="5") {$bmr=$bmr*1.9;}
echo "<strong>Daily Calorie Needs</strong><br />";
echo "<strong>".round($bmr,0)." Calories/day</strong><br />";
}
$domain = $_SERVER['HTTP_HOST'];
$path = $_SERVER['SCRIPT_NAME'];
$queryString = $_SERVER['QUERY_STRING'];
$url = "http://" . $domain . $path;
$url3 = "http://" . $domain . $_SERVER['REQUEST_URI'];
$mystring1="?";
$s1=strpos($url3,$mystring1);
if($s1==0) {$url2=$url3;}
if($s1!=0) {$url2=substr($url3,0,$s1);}
$path = $url2;
//1 foot = 0.3048 meters
//1 inch = 2.54 centimeters
//1 pound = 0.45359237 kilograms
$n1=230;
echo "<table style=\"width: 100%\" cellspacing=\"2\" cellpadding=\"2\" align=\"center\"><tr><td valign=\"top\">";
// echo "<h3>Daily Calorie Calculator</h3>";
echo "<form action=\"".$path."\" method=\"post\" >";
echo "<strong>Age</strong><p />";
echo "<input name=\"age\" type=text size=\"5\" >";
echo "<p />";
echo "<strong>Gender</strong><p />";
echo "<select name=\"gender\" >";
echo "<option value=\"1\">Male</option>";
echo "<option value=\"2\">Female</option>";
echo "</select>";
echo "<p />";
echo "<strong>Height</strong><p />";
echo "<select name=\"heightcm\" >";
for ($i=30; $i<=$n1; $i++){ echo "<option value=\"$i\">".$i." cm / ".floor($i / 30.48)." ft ".round(($i-(floor($i / 30.48)*30.48)) / 2.54, 1)." in </option>";}
echo "</select>";
echo "<p />";
echo "<strong>Weight</strong><p />";
echo "<select name=\"weightkg\" >";
for ($i=30; $i<=$n1; $i++){ echo "<option value=\"$i\">".$i." kg / ".round($i / 0.45359237,2)." pounds </option>";}
echo "</select>";
echo "<p />";
echo "<strong>Activity</strong><p />";
echo "<select name=\"activity\" >";
echo "<option value=\"1\">Sedentary</option>";
echo "<option value=\"2\">Lightly Active</option>";
echo "<option value=\"3\">Moderately Active</option>";
echo "<option value=\"4\">Very Active</option>";
echo "<option value=\"5\">Extra Active</option>";
echo "</select>";
echo "<br />";
echo "<br />";
echo "<input class=\"art-button\" type=\"submit\" value=\"Calculate\" name=\"B1\">";
echo "</form><br />";
//DON'T REMOVE THIS LINK - DO NOT VIOLATE GNU/GPL LICENSE!
echo "<a href=\"http://nutritioncaloriecounter.com\"></a>";
//DON'T REMOVE THIS LINK - DO NOT VIOLATE GNU/GPL LICENSE!
echo "</td></tr></table>";
?>
one I can learn from!
...
I'll have to go back to the developer I guess.