Enter your friend's e-mail to share this page!

Weight Loss and Fitness Information

Search us:

#!/usr/bin/perl # ######################################### # Fatalyzer # # # # by David J Spelts # # http://www.spelts.com/ # # dave@spelts.com # # # ######################################### #Do not edit below this line ############################################################################################## print "Content-type: text/html\n\n"; MAIN: { &ReadParse; if ($in{'Mid Thigh'}) { &Percentage; } elsif ($in{'sex'} eq "Male") { &Male; } elsif ($in{'sex'} eq "Female") { &Female; } else { &ShowForm; } } ############# ShowForm ################# sub ShowForm { print <HTML> Fatalyzer

Fatalyzer

Fatalyzer will calculate your percentage of bodyfat based on various skinfold measurements. You will need skinfold calipers in order to obtain these measurements.

Sex: Male
Female
Age:

EOT } ############# Male ################# sub Male { $sex = $in{'sex'}; $age = $in{'age'}; print <HTML> Fatalyzer

Fatalyzer

Enter your skinfold measurements (in millimeters).
Upper Chest
Mid Abdomen
Mid Thigh

EOT } ############# Female ################# sub Female { $sex = $in{'sex'}; $age = $in{'age'}; print <HTML> Fatalyzer

Fatalyzer

Enter your skinfold measurements (in millimeters).
Tricep
Far Right Abdomen
Mid Thigh

EOT } ############# Percentage ################# sub Percentage { $sex = $in{'sex'}; $age = $in{'age'}; $skinfoldsum = $in{'Upper Chest'} + $in{'Mid Abdomen'} + $in{'Mid Thigh'} + $in{'Tricep'} + $in{'Far Right Abdomen'}; $skinfoldsquared = $skinfoldsum * $skinfoldsum; if ($sex eq "Male") { $bd = 1.10938 - (0.0008267 * $skinfoldsum) + (0.0000016 * $skinfoldsquared) - (0.0002574 * $age); } elsif ($sex eq "Female") { $bd = 1.099421 - (0.0009929 * $skinfoldsum) + (0.0000023 * $skinfoldsquared) - (0.0001392 * $age); } $bodyfat = sprintf("%.1f",(((457 / $bd) - 414.2) + ((495 / $bd) - 450)) / 2); print <HTML> Fatalyzer

Fatalyzer

Your bodyfat percentage is: $bodyfat \%
Download Windows version

 
EOT } ############## ReadParse ################ sub ReadParse { local (*in)= @_ if @_; local ($i,$key,$val); # Read in text if (&MethGet) { $in=$ENV{'QUERY_STRING'}; } elsif (&MethPost) { read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); } @in=split(/[&;]/,$in); foreach $i (0..$#in) { #Convert plus"s to spaces $in[$i] =~ s/\+/ /g; #Split into key and value. ($key, $val) = split(/=/,$in[$i],2); # splits on the first =. #Convert %XX from hex numbers to alphanumeric $key =~ s/%(..)/pack("c",hex($1))/ge; $val =~ s/%(..)/pack("c",hex($1))/ge; #Associate key and value $in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple separator $in{$key} .= $val; } return scalar(@in); } ####### MethGet ############## sub MethGet { return ($ENV{'REQUEST_METHOD'} eq "GET"); } ####### MethPost ############## sub MethPost { return ($ENV{'REQUEST_METHOD'} eq "POST"); }

Site Meter

CLICK HERE to get a $25 rebate on any treadmill - monthly payment plans available!
Use the discount code TEN to get 10% off your entire purchase at youcansave.
FDA approved weight loss products
© 2002 Ideal Fitness, Inc.
All rights reserved.
Make Inch-Aweigh your home!