From e83d5aa08680c6a8d7fb70d7c320f0d42862411e Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Mon, 14 May 2007 20:49:16 +0000 Subject: [PATCH] Add a minimalist user identification in banana example script git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@255 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- banana/page.inc.php | 4 +++- examples/index.php | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/banana/page.inc.php b/banana/page.inc.php index 883865c..0fa2273 100644 --- a/banana/page.inc.php +++ b/banana/page.inc.php @@ -7,7 +7,9 @@ * Copyright: See COPYING files that comes with this distribution ********************************************************************************/ -require_once 'smarty/libs/Smarty.class.php'; +if (!include_once('Smarty.class.php')) { + require_once 'smarty/libs/Smarty.class.php'; +} class BananaPage extends Smarty { diff --git a/examples/index.php b/examples/index.php index 3995249..f4e71b4 100644 --- a/examples/index.php +++ b/examples/index.php @@ -29,6 +29,50 @@ class MyBanana extends Banana } } +if (!isset($_SESSION['banana_email']) || isset($_POST['change_login']) || isset($_POST['valid_change'])) { + if (isset($_COOKIE['banana_login']) && !isset($_POST['change_login']) && !isset($_POST['valid_change'])) { + $_SESSION['banana_email'] = $_COOKIE['banana_email']; + } elseif (isset($_POST['valid_change'])) { + $_SESSION['banana_name'] = $_POST['name']; + $_SESSION['banana_email'] = $_POST['email']; + setcookie('banana_name', $_POST['name'], time() + 25920000); + setcookie('banana_email', $_POST['email'], time() + 25920000); + } else { +?> + + + + + + + Banana, a NNTP<->Web Gateway + + +
+

Les Forums de Banana

+ Merci d'entrer vos identifiants pour accéder à Banana : +
+
+ Nom :
+ Email : +
+ +
+
+
+
+ Banana, a Web interface for a NNTP Server
+ Developed under GPL License for Polytechnique.org
+ Use silk icons from www.famfamfam.com +
+
+ + +'; Banana::$profile['lastnews'] = $_SESSION['banana_lastnews']; setcookie('banana_lastnews', time(), time() + 25920000); @@ -77,11 +123,20 @@ session_write_close();

Les Forums de Banana

+
+
+
+ Vous êtes :
+
+ +
+
Banana, a Web interface for a NNTP Server
- Developed under GPL License for Polytechnique.org + Developed under GPL License for Polytechnique.org
Use silk icons from www.famfamfam.com
+