diff options
| -rw-r--r-- | register.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/register.php b/register.php index 56092e4..d29f698 100644 --- a/register.php +++ b/register.php @@ -107,6 +107,11 @@ if ( isset($_POST['action']) && ($_POST['action'] == "registerUser") ) { $_SESSION['user']['birthday'] = $birthday; $_SESSION['user']['gender'] = $_POST['gender']; + # determine the users age and put it in the session so that we don't have + # to calculate it over and over again as they view things. 31536000 is the + # number of seconds in a year. + $_SESSION['user']['age'] = floor((time() - $db->_row['birthday'])/31536000); + # now let's add the default nutrients as the users default set of nutrients $sql = sprintf(" INSERT INTO userNutrients(user, nutrient) |
