diff options
| author | Nathan Kinkade <nath@nkinka.de> | 2008-02-03 23:23:24 +0000 |
|---|---|---|
| committer | Nathan Kinkade <nath@nkinka.de> | 2008-02-03 23:23:24 +0000 |
| commit | d895b852a6e160496ffc760d46d3719a3d62ff86 (patch) | |
| tree | 52230bb04148197e8312e09b5c5273417e7a3be9 /list_diaries.php | |
Initial checkin of nutridb.org and basic subversion directory structure
Diffstat (limited to 'list_diaries.php')
| -rw-r--r-- | list_diaries.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/list_diaries.php b/list_diaries.php new file mode 100644 index 0000000..bea701a --- /dev/null +++ b/list_diaries.php @@ -0,0 +1,37 @@ +<?php + +# include the main site config where various global variables +# and libraries are included +require("config.php"); + +# the user must be logged in to access this script. if they are +# not then this function will send them back to the index page +loginRequired(); + +# grab all of the users saved meals +$sql = sprintf (" + SELECT userDiaries.* + FROM userDiaries INNER JOIN users + ON userDiaries.user = users.id + WHERE users.id = '%s' + ORDER BY userDiaries.description + ", + $_SESSION['user']['id'] +); +$db->Select($sql); +if ( $db->_rowCount > 0 ) { + $smarty->assign("diaryCount", $db->_rowCount); + $smarty->assign("userDiaries", $db->_rows); +} + +# grab the various parts. these sections are not printed to the screen +# but rather dumped into smarty variables that will simply be printed +# in the template, so the order doesn't matter here at the moment +require("header.php"); +require("sidebar_left.php"); +require("sidebar_right.php"); +require("footer.php"); + +$smarty->display("list_diaries.tpl"); + +?> |
