From 44b6591750912a7b78b5b15d1c40775c81ed06ab Mon Sep 17 00:00:00 2001 From: echavezNS Date: Fri, 18 Mar 2016 18:13:13 -0700 Subject: [PATCH] Add showFeedback function --- index.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/index.php b/index.php index 7ebb1db..4c8d3c4 100644 --- a/index.php +++ b/index.php @@ -346,6 +346,15 @@ public function getUserLoginStatus() return $this->user_is_logged_in; } + /** + * Show feedback function, you can custom the way it's shown + */ + private function showFeedback(){ + if ($this->feedback) { + echo $this->feedback . "

"; + } + } + /** * Simple demo-"page" that will be shown when the user is logged in. * In a real application you would probably include an html-template here, but for this extremely simple @@ -353,9 +362,7 @@ public function getUserLoginStatus() */ private function showPageLoggedIn() { - if ($this->feedback) { - echo $this->feedback . "

"; - } + $this->showFeedback(); echo 'Hello ' . $_SESSION['user_name'] . ', you are logged in.

'; echo 'Log out'; @@ -368,9 +375,7 @@ private function showPageLoggedIn() */ private function showPageLoginForm() { - if ($this->feedback) { - echo $this->feedback . "

"; - } + $this->showFeedback(); echo '

Login

'; @@ -392,9 +397,7 @@ private function showPageLoginForm() */ private function showPageRegistration() { - if ($this->feedback) { - echo $this->feedback . "

"; - } + $this->showFeedback(); echo '

Registration

';