12/21/2003 ↓

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

Author: Mark Ghosh Category: Web Ethics

Thanks for visiting! We would like to serve you better. Please subscribe to our RSS feed for daily updates. This blog posts regular Wordpress news, updates of themes, plugins, ideas, hacks, quick fixes and everything about blogging, especially about Wordpress. You can also receive updates from this blog via email if you want that method of notification.

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

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Visitors who read this post, also read:

    Friends

    Translate

    Translate to German Translate to Spanish Translate to French Translate to Italian Translate to Portuguese Translate to Japanese Translate to Korean Translate to Russian Translate to Chinese

    Latest Videos

    Leave a comment

    Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    (required)

    (required, will not be published)


    S2