post-page

It is illegal to collect personal information from people under the age of 13

No
responses
by
 
on
December 21st, 2003
in
Web Ethics

Because of the Children’s Online Privacy Protection Act, also known as C.O.P.P.A. (or COPPA), it’s illegal to collect personal information from people under the age of 13. This means it’s very important to verify the age of anyone who enters such information into your Web site, but the problem with verifying ages is that the verification properties change every day because we get older every day. Here’s a little function that’s written in PHP and will dynamically check user age input in real time and let you know if you are within the law to collect information about this user. I’ve used this particular piece of code for a few years and it’s a great toolbox piece when you’re collecting user information on your website because it keeps you legal!

< ?php /* Name: coppa_check($day, $month, $year) Author: Jason DeFillippo

Description: This is a down and dirty COPPA age verifier. This function takes 3 arguments. A birthday, a birthmonth and a birthyear and returns the user’s actual age if it’s good and false if it’s non-compliant. Throw this into a general include file and slap it in your library and you won’t have to worry if you’re letting any kids in. This is an important issue since it’s illegal to gather user data if the person is under 13 years old.

*/

function coppa_check($day, $month, $year){

// I declare these variables in the name of France!
//
//we set minimum age which should be 13 as long as
//the law is in effect. We set the max age to be
//the ever fluctuating lifespan of the human animal.
$min_age = 13;
$max_age = 130;

// check to see if we have a 2 digit year. If so
// convert it to standard 4 char format usign 19
// as a base since there are no 13 year olds born
// in 20XX yet.
if (strlen($year) == 2){$year = “19” . $year;}

//First do a check to see if we have a good date
$isgood = checkdate($month, $day, $year);

//dump it if the date is bad…
if ($isgood != 1){
return FALSE;
}

// do some date to timestamp conversions so we’re all
// talking the same format.
$birthdate = mktime(0,0,0,$month,$day,$year);
$today = time();

// now do them back so we can get some different info.
$old_date = getdate($birthdate);
$current_date = getdate($today);

// error check to make sure the date’s not in the future
// note: add Tardis check for Timelords and the like
if ($current_date[year] < $year){return FALSE;} // Adjust for day of the month and get final age. if ($current_date[yday] >= $old_date[yday]){
$age = $current_date[year] – $year;
}else{
$age = ($current_date[year] – $year) -1;
}

// Age range check from vars set at func open
if ($age < $min_age || $age > $max_age){
return FALSE;
}

//fallthru and spit back the actual age just for fun.
return $age;

}//end coppa_check

?>

Example code:

< ?php //This is a simple validity check to make sure the //age entered is over $min_age and under $max_age. //If it is within tolerance $age is returned. if (! $age = coppa_check(8, 5, 1971)){ echo "Non-compliant age"; } ?>

Excerpt from: LockerGnome Web Development

heading
heading
No
Responses

 

Comments are closed.

Obviously Powered by WordPress. © 2003-2013

css.php