cvs: pear /LiveUser/docs/examples/example5 conf.php
| From: | Lukas Smith | Date: | Thu, 09 Jun 2005 14:23:43 +0000 |
| Subject: | cvs: pear /LiveUser/docs/examples/example5 conf.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-32445@lists.php.net to get a copy of this message | ||
lsmith Thu Jun 9 10:23:43 2005 EDT
Modified files:
/pear/LiveUser/docs/examples/example5 conf.php
Log:
- some fixes to update to the new API (but the example is still broken)
http://cvs.php.net/diff.php/pear/LiveUser/docs/examples/example5/conf.php?r1=1.4&r2=1.5&ty=u
Index: pear/LiveUser/docs/examples/example5/conf.php
diff -u pear/LiveUser/docs/examples/example5/conf.php:1.4
pear/LiveUser/docs/examples/example5/conf.php:1.5
--- pear/LiveUser/docs/examples/example5/conf.php:1.4 Thu Jun 9 09:07:26 2005
+++ pear/LiveUser/docs/examples/example5/conf.php Thu Jun 9 10:23:43 2005
@@ -4,8 +4,7 @@
// Plase configure the following file according to your environment
//$dsn = '{dbtype}://{user}:{passwd}@{dbhost}/{dbname}';
-
-$dsn = 'mysql://root:@localhost/pear_test';
+$dsn = 'mysql://root:@localhost/liveuser_test_example5';
$db = DB::connect($dsn);
@@ -24,19 +23,10 @@
'varname' => 'ludata'
),
'login' => array(
- 'method' => 'post',
- 'username' => 'handle',
- 'password' => 'passwd',
'force' => false,
- 'function' => '',
- 'remember' => 'rememberMe'
),
'logout' => array(
- 'trigger' => 'logout',
- 'redirect' => 'home.php',
'destroy' => true,
- 'method' => 'get',
- 'function' => ''
),
'authContainers' => array(
'DB' => array(
@@ -66,30 +56,23 @@
)
)
),
- 'permContainer' => array(
- 'dsn' => $dsn,
- 'type' => 'DB_Medium',
- 'prefix' => 'liveuser_'
- )
- );
-
-function logOut()
-{
-}
-
-function logIn()
-{
-}
+ 'permContainer' => array(
+ 'type' => 'Medium',
+ 'storage' => array('DB' => array('dsn' => $dsn,
'prefix' => 'liveuser_')),
+ ),
+);
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
$usr = LiveUser::singleton($conf);
-$usr->setLoginFunction('logIn');
-$usr->setLogOutFunction('logOut');
-
-$e = $usr->init();
-if (PEAR::isError($e)) {
-//var_dump($usr);
- die($e->getMessage() . ' ' . $e->getUserinfo());
+$username = (isset($_REQUEST['username'])) ? $_REQUEST['username'] : null;
+$password = (isset($_REQUEST['password'])) ? $_REQUEST['password'] : null;
+$logout = (isset($_REQUEST['logout'])) ? $_REQUEST['logout'] : false;
+$remember = (isset($_REQUEST['rememberMe'])) ? $_REQUEST['rememberMe'] : false;
+
+if (!$usr->init($username, $password, $logout, $remember)
+ && $usr->getErrors()
+) {
+ var_dump($usr->getErrors());
}