Hi,
How would i check if some one is older than 16 years of age?
I have a "new user" form which allows people to create a user account. I want to be able to make sure that anyone who is creating a user account is 16 years or older.
Thanks.
Checking date of birth
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: Checking date of birth
Can we see some code, so we can make some suggestions???
- mikeeeeeeey
- Forum Contributor
- Posts: 130
- Joined: Mon Jul 03, 2006 4:17 am
- Location: Huddersfield, UK
Hi there, just tried to think up a solution for myself, but its actually quite hard!
Here's some code I've just had a quick blast through, the number it outputs ($num), may look like a random number but the first 2 digits represent the user's age.
Its far from finished, but it's here if you want to use it as a starting point.
Hope it helps!
Here's some code I've just had a quick blast through, the number it outputs ($num), may look like a random number but the first 2 digits represent the user's age.
Its far from finished, but it's here if you want to use it as a starting point.
Code: Select all
$user_birth = (int)$_POST['yyyy'] . $_POST['mm'] . $_POST['dd'];
$date = (int)date("omd");
$sum = ($date - $user_birth);
if(isset($_POST['submit'])){
echo "User is " . $sum . " years old";
}