birthday error checking - if year is present but no month or day, set to 1 January. Otherwise the date will be set to 30 November the prior year due to how the PHP strtotime() function works.

This commit is contained in:
friendica 2013-07-03 16:55:57 -07:00
parent 429ebabfd9
commit 42d5d515b2

View File

@ -200,6 +200,11 @@ function profiles_post(&$a) {
$day = intval($_POST['day']);
if(($day > $mtab[$month]) || ($day < 0))
$day = 0;
if($year && (! ($month && $day))) {
$month = 1; $day = 1;
}
$dob = '0000-00-00';
$dob = sprintf('%04d-%02d-%02d',$year,$month,$day);