From cfee75d634301bc2600e88519873dd034c5708b9 Mon Sep 17 00:00:00 2001 From: Nathan Kinkade Date: Sat, 8 Mar 2008 19:09:28 +0000 Subject: Fixed bug where age wasn't being calculated and added to session after new user registration. --- register.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'register.php') 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) -- cgit v1.2.3