Fix bug when user entered a birthdate on 2 digits during regisstration
authorAymeric Augustin <aymeric.augustin@m4x.org>
Sun, 9 Mar 2008 16:41:41 +0000 (17:41 +0100)
committerAymeric Augustin <aymeric.augustin@m4x.org>
Sun, 9 Mar 2008 16:42:41 +0000 (17:42 +0100)
modules/register.php

index 69a8ae5..ee95c8f 100644 (file)
@@ -148,8 +148,10 @@ class RegisterModule extends PLModule
                         $err[] = "La 'Date de naissance' n'est pas correcte.";
                     } else {
                         $birth = explode('/', $birth, 3);
-                        $year  = intval($birth[2]);
-                        if ($year < 100) $year += 1900;
+                        for ($i = 0; $i < 3; $i++)
+                            $birth[$i] = intval($birth[$i]);
+                        if ($birth[2] < 100) $birth[2] += 1900;
+                        $year  = $birth[2];
                         $promo = (int)$sub_state['promo'];
                         if ($year > $promo - 15 || $year < $promo - 30) {
                             $err[] = "La 'Date de naissance' n'est pas correcte.";