[Typo3] Age Verification
Frank Sutton
fsutton at gameherd.com
Thu Aug 11 00:53:27 CEST 2005
Hi Matthias,
I thank you for the kind reply!
-Frank
Matthias Kall wrote:
> Hi Frank,
>
> here is a function to get a persons age in years:
> (example from php.net)
>
> function persons_age($year, $month, $day)
> {
> $tmonth = date('n');
> $tday = date('j');
> $tyear = date('Y');
> $years = $tyear - $year;
> if ($tmonth <= $month)
> {
> if ($month == $tmonth)
> {
> if ($day > $tday)
> $years--;
> }
> else
> $years--;
> }
> return $years;
> }
>
> you might want to implement a function like this and call it in your if
> statement:
>
> If ($this->persons_age($year, $month, $day) >= 13) {
> ...
>
> Instead of $year, $month, $day you can also use the php date functions
> to get the parts out of your variable $dateOfBirthField
>
> Greets
>
> Matthias
>
>
More information about the TYPO3-english
mailing list