summaryrefslogtreecommitdiff
path: root/register.php
diff options
context:
space:
mode:
authorNathan Kinkade <nath@nkinka.de>2008-03-08 19:09:28 +0000
committerNathan Kinkade <nath@nkinka.de>2008-03-08 19:09:28 +0000
commitcfee75d634301bc2600e88519873dd034c5708b9 (patch)
treec1221f48f9613d97936f9406a6bc29c0d7032122 /register.php
parent196cb8334747d04de28a97c61b91c793fecb70e6 (diff)
Fixed bug where age wasn't being calculated and added to session after new user registration.
Diffstat (limited to 'register.php')
-rw-r--r--register.php5
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)