diff --git a/config.php b/config.php index 6a5ed26..ca7f129 100644 --- a/config.php +++ b/config.php @@ -41,6 +41,10 @@ function crypt_password ($pass, $salt) { // the session_start(); +if (!isset($_SESSION['logged_in'])) { + $_SESSION['logged_in'] = false; +} + if (!isset($notemplate)) { require_once 'ext/rain.tpl.class.php'; @@ -48,4 +52,24 @@ if (!isset($notemplate)) { raintpl::configure("tpl_dir", "views/"); $tpl = new RainTPL; + + // new words counter + $new_words_count = -1; + if ($_SESSION['logged_in'] === true) { + $res = $sql->query("SELECT `id` FROM `words` WHERE `new` = 1;"); + $new_words_count = $res->num_rows; + } + + // total words count + $res = $sql->query("SELECT `id` FROM `words`;"); + $words_total_count = $res->num_rows * 3; + + // site name + $res = $sql->query("SELECT `value` FROM `config` WHERE `key` = \"sitename\";")->fetch_assoc(); + $site_name = htmlspecialchars($res['value']); + + $tpl->assign("logged_in", $_SESSION['logged_in']); + $tpl->assign("site_name", $site_name); + $tpl->assign("words_total", $words_total_count); + $tpl->assign("inbox_count", $new_words_count); } \ No newline at end of file diff --git a/index.php b/index.php index e69de29..c59255c 100644 --- a/index.php +++ b/index.php @@ -0,0 +1,23 @@ + + * + * Oh, and before I forget... + * ________ __________ __ ____ __ ______ + * / ____/ / / / ____/ //_/ / __ \/ / / / __ \ + * / /_ / / / / / / ,< / /_/ / /_/ / /_/ / with + * / __/ / /_/ / /___/ /| | / ____/ __ / ____/ a + * /_/ \____/\____/_/ |_| /_/ /_/ /_/_/ cactus! + * + * Thanks for listening. + */ + +include_once 'config.php'; + +$tpl->draw("index"); \ No newline at end of file diff --git a/views/index.html b/views/index.html index 5719a82..b48ca55 100644 --- a/views/index.html +++ b/views/index.html @@ -1,7 +1,7 @@ {include="layout"} {include="navbar"}
-

{$site_title}!

+

{$site_name}!

Want to tell them who you are?

diff --git a/views/layout.html b/views/layout.html index 0c01963..82db790 100644 --- a/views/layout.html +++ b/views/layout.html @@ -4,7 +4,7 @@ - {$site_title} + {$site_name} diff --git a/views/navbar.html b/views/navbar.html index f5c3e98..f45ab80 100644 --- a/views/navbar.html +++ b/views/navbar.html @@ -8,7 +8,7 @@ - {$site_title} + {$site_name}
@@ -18,7 +18,7 @@