 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
eabris
Joined: 11 May 2006 Posts: 1
|
Posted: Thu May 11, 2006 10:55 am Post subject: Liveuser with Quickform, Callback.php on line 66 |
|
|
This is the error message when i try to log in my access page:
Warning: call_user_func(html_quickform::is_pswd_ok): First argument is expected to be a valid callback in /.../HTML/QuickForm/Rule/Callback.php on line 66
The all other packages are working. What could be the problem with Quickform?
I used this tutorial: http://www.gvngroup.be/doc/LiveUser/index.php
Thanks |
|
| Back to top |
|
 |
obiwan
Joined: 18 Jun 2006 Posts: 1 Location: Regensburg/Germany
|
Posted: Sun Jun 18, 2006 9:14 pm Post subject: |
|
|
I finally got it working!
1) You have do replace the config-array in the provided conf.php with that from the example4 which comes with the LiveUser-Package.
2) the is_pswd_ok()-function needs an extra "global $LU". |
|
| Back to top |
|
 |
ermes
Joined: 20 Jun 2006 Posts: 2 Location: italy
|
Posted: Wed Jun 21, 2006 8:28 am Post subject: |
|
|
excuse me for my bad english (I'm italian)
I've a similar problem and I have not understood like resolving the problem.
this is the message of my web page:
Warning: call_user_func(Date.php::check_data) [function.call-user-func]: First argument is expected to be a valid callback in C:\xampp\php\pear\HTML\QuickForm\Rule\Callback.php on line 66
the warning is found on function check_data if is used like a parameter of PEAR::QuickForm function.
In this case, the function does not work correctly but it works correctly when it is used like a simple function.
excuse me.
thanks  _________________ Ermes Beretta |
|
| Back to top |
|
 |
briz
Joined: 30 Aug 2006 Posts: 2 Location: USA
|
Posted: Thu Aug 31, 2006 12:43 am Post subject: Liveuser with Quickform, Callback.php on line 66 |
|
|
Hi all,
New to PEAR and getting the same error, and need LiveUser complex for a project.
I tried obiwan's solution, but it didn't seem to work. I must have done something different.
How did obiwan find the solution? After tracing the code I found that the line 66 is
return call_user_func(array($callback[1], $callback[0]), $value, $options);
And the $callback array holds:
$callback[0] = 'Object'
$callback[1] = 'is_pswd_ok'
The method is_pswd_ok() is never called as the code seems to intend.
What is not valid? What should it be? Where should it be changed?
Thanks |
|
| Back to top |
|
 |
zzeroo
Joined: 16 Feb 2007 Posts: 1
|
Posted: Fri Feb 16, 2007 7:49 pm Post subject: |
|
|
All what You've to do is wroth by obiwan 2 Post ago.
copy the
| Code: | 'alias' => array(
'auth_user_id' => 'authUserId',
'lastlogin' => 'lastLogin',
'is_active' => 'isActive',
'owner_user_id' => 'owner_user_id',
'owner_group_id' => 'owner_group_id',
'users' => 'peoples',
),
'fields' => array(
'lastlogin' => 'timestamp',
'is_active' => 'boolean',
'owner_user_id' => 'integer',
'owner_group_id' => 'integer',
),
'tables' => array(
'users' => array(
'fields' => array(
'lastlogin' => false,
'is_active' => false,
'owner_user_id' => false,
'owner_group_id' => false,
),
|
from the example4 conf.php to Your conf.php and set global $LU in the function is_pswd_ok().
like
| Code: |
function is_pswd_ok(&$passwd)
{
global $LU;
$LU->login($LU->getProperty('handle'),$LU->getProperty('passwd'));
if ($LU->isLoggedIn())
{
|
In german we say: "Wer lesen kann ist klar im Vorteil!" |
|
| Back to top |
|
 |
ckosny
Joined: 22 May 2007 Posts: 2
|
Posted: Tue May 22, 2007 5:42 pm Post subject: |
|
|
In the line
$form->registerRule('check_pswd', 'callback', 'is_pswd_ok', $form);
a Quickform rule giving $form as the last parameter is registered. This causes problems with Quickform (at least with the current version) as this last parameter is used as a class container for the callback function.
Therefore Quickform tries to call Quickform::is_pswd_ok() as callback which does not exist. Just remove the last parameter.
In addition to the info in the previous posts the Qucikform error should be fixed.
If you still can not log in try to remove the line $LU->login($LU->getProperty('handle'),$LU->getProperty('passwd'));
in the callback.
Maybe I understand this wrong but I think that the login is already done in the conf.php and as $LU->getProperty('passwd') returns the md5 hash out of the database for the logged in user a new login with these data cannot work.
Claudia |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Tue May 22, 2007 9:04 pm Post subject: |
|
|
| Claudia, please report a bug about the bogus $form parameter. If the developers don't know about it, they can't fix the problem. |
|
| Back to top |
|
 |
ckosny
Joined: 22 May 2007 Posts: 2
|
Posted: Wed May 23, 2007 9:02 am Post subject: |
|
|
Hi Mark
I am not sure which developers you mean. After all the error is just in the tutorial made by gvngroup, not in any pear package. I told gvngroup about the error yesterday so hopefully they will confirm it and correct the tutorial soon. |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Wed May 23, 2007 10:51 am Post subject: |
|
|
I thought that the bug would have been in example bundled with LiveUser. But that's not the case, ignore me please.  |
|
| Back to top |
|
 |
nucdream
Joined: 30 Oct 2008 Posts: 5
|
Posted: Fri Oct 31, 2008 2:50 am Post subject: |
|
|
I get the LiveUser totutial form
http://www.gvngroup.be/doc/LiveUser/authentication_example.php
but it has the error as following:
Warning: call_user_func(HTML_QuickForm::is_pswd_ok) [function.call-user-func]: First argument is expected to be a valid callback in E:\apmserv\APMServ5.2.6\PHP\PEAR\HTML\QuickForm\Rule\Callback.php on line 77
who can help me? _________________ http://www.flyourdream.cn pear class |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Fri Oct 31, 2008 9:04 am Post subject: |
|
|
| nucdream wrote: | I get the LiveUser totutial form
http://www.gvngroup.be/doc/LiveUser/authentication_example.php
but it has the error as following:
Warning: call_user_func(HTML_QuickForm::is_pswd_ok) [function.call-user-func]: First argument is expected to be a valid callback in E:\apmserv\APMServ5.2.6\PHP\PEAR\HTML\QuickForm\Rule\Callback.php on line 77
who can help me? |
Help yourself and re-read this thread, the solution is mentioned here. (Hint: Look for Claudia's post.) |
|
| Back to top |
|
 |
nucdream
Joined: 30 Oct 2008 Posts: 5
|
Posted: Sat Nov 01, 2008 5:19 am Post subject: liveuser->login does not return false and script stops ex |
|
|
2008-06-10 22:57 UTC
Bug Open
0.16.13 5.2.6
Win XP
liveuser->login does not return false and script stops executing
is the problem of PHP5.2.6??? _________________ http://www.flyourdream.cn pear class |
|
| Back to top |
|
 |
nucdream
Joined: 30 Oct 2008 Posts: 5
|
Posted: Sat Nov 01, 2008 5:42 am Post subject: who can help me ? |
|
|
Why my liveuser->login does not return false and script stops executing?
Version
PHP is 5.2.0
LiveUser is 0.16.12 beta
my code is:
conf.php
| Code: | <?php
require_once 'MDB2.php';
require_once 'LiveUser.php';
$db_name = 'root';
$db_password = '123456';
$db_server = 'localhost';
$db_database = 'hbcms';
$dsn ='mysql://' . $db_name . ':' . $db_password . '@' . $db_server . '/' . $db_database;
//$dsn mysql://root:flyourdream@localhost/liveuser
$db =& MDB2::connect($dsn);
if (PEAR::isError($db))
{
echo $db->getMessage() . ' ' . $db->getUserInfo();
}
//echo md5("123456");
$db->setFetchMode(MDB2_FETCHMODE_ASSOC);
$conf =
array(
'debug' => true,
'session' => array(
'name' => 'PHPSESSION', // liveuser session name
'varname' => 'ludata' // liveuser session var name
),
'login' => array(
'force' => false // should the user be forced to login
),
'logout' => array(
'destroy' => true // whether to destroy the session on logout
),
"cookie" => array(
"name" => "admin",
"lifetime" => 30,
"path" => "/",
"domain" => null,
"secret" => "123456",
"savedir" => ".",
"secure" => false
),
'authContainers' => array(
array(
'type' => 'MDB2', // auth container name
'expireTime' => 3600, // max lifetime of a session in seconds
'idleTime' => 3600, // max time between 2 requests
'allowDuplicateHandles' => 0,
'allowEmptyPasswords' => 0, // 0=false, 1=true
'passwordEncryptionMode'=> 'MD5',
//'secret' => 'test',
'storage' => array(
'dsn' => $dsn,
'prefix' => 'liveuser_',
'alias' => array( // contains any additional
// or non-default field alias
'auth_user_id' => 'auth_user_id',
'handle' => 'handle',
'passwd' => 'passwd',
'lastlogin' => 'last_login',
'is_active' => 'is_active',
'owner_user_id' => 'owner_user_id',
'owner_group_id' => 'owner_group_id',
'email' => 'email'
),
'fields' => array( // contains any additional
// or non-default field types
'lastlogin' => 'timestamp',
'is_active' => 'integer',
'owner_user_id' => 'integer',
'owner_group_id' => 'integer',
'email' => 'text'
),
'tables' => array( // contains additional tables
// or fields in existing tables
'users' => array(
'fields' => array(
'lastlogin' => false,
'is_active' => false,
'owner_user_id' => false,
'owner_group_id' => false,
'email' => false
)
)
)
)
)
)
);
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
$LU = LiveUser::singleton($conf);
if (!$LU->init()) {
var_dump($LU->getErrors());
die();
}
//echo $LU->getProperty('handle')." , ".$LU->getProperty('passwd');
echo $LU->login('admin','123456');
//exit;
//print_r($_SESSION);
print_r ($LU->isLoggedIn());
echo "here";
$handle = (array_key_exists('handle', $_REQUEST)) ? $_REQUEST['handle'] : null;
$passwd = (array_key_exists('passwd', $_REQUEST)) ? $_REQUEST['passwd'] : null;
$logout = (array_key_exists('logout', $_REQUEST)) ? $_REQUEST['logout'] : false;
if ($logout)
{
// $LU->logout(true);
$LU->logout(false); // does not delete the RememberMe cookie
}
elseif(!$LU->isLoggedIn() || ($handle && $LU->getProperty('handle') != $handle))
{
//echo "here";
echo $handle." ".$passwd;
if (!$handle)
{
//echo "not here";
$LU->login(null, null, true);
}
else
{
//echo "here";
$LU->login($handle,$passwd,false);
//setcookie( "LoginName", $handle, time( ) + 2592000, "/" );
//echo $re;
//var_dump($LU);
}
}
?> |
login.php
| Code: | <?php
require_once("conf.php");
page_top();
if (!$LU->isLoggedIn())
{
echo '<h1>Login</h1>';
show_login();
}
else
{
echo '<h1>LiveUser Example</h1>';
echo '<a href="?logout=1">Logout</a><br /><br />';
echo '<p>Welcome <em>' . $LU->getProperty('handle') . '</em>!</p>';
echo '<p>Here is the contents of the "liveuser_users" table:</p>';
echo '<ul>';
echo ' <li>auth_user_id:' . $LU->getProperty('auth_user_id') . '</li>';
echo ' <li>handle:' . $LU->getProperty('handle') . '</li>';
echo ' <li>passwd:' . $LU->getProperty('passwd') . '</li>';
echo ' <li>owner_user_id:' . $LU->getProperty('owner_user_id') . '</li>';
echo ' <li>owner_group_id:' . $LU->getProperty('owner_group_id') . '</li>';
echo ' <li>lastlogin:' . date('d.m.Y H:i', $LU->getProperty('lastlogin')) . '</li>';
echo ' <li>is_active:' . $LU->getProperty('passwd') . '</li>';
echo ' <li>email: ' . $LU->getProperty('email') . '</li>';
echo '</ul>';
}
page_bottom();
function page_top()
{
echo '<html><head>';
echo '<link rel="stylesheet" type="text/css" href="test.css" media="screen" />';
echo '</head><body>';
}
function page_bottom()
{
echo '</body></html>';
}
function show_login()
{
//ini_set("include_path", '../../libs/PEAR/' . PATH_SEPARATOR . ini_get("include_path"));
require_once ("HTML/QuickForm.php");
echo '<p>Please log in to access this page</p>';
$form =& new HTML_Quickform('logon', 'post');
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate('<tr><td align="left" valign="top" width="150">
<p><span class="label">{label}</span><!-- BEGIN required -->
<span class="mandatory"> (*)</span><!-- END required --></p></td>
<td valign="top" align="left"><!-- BEGIN error --><span class="error_msg">{error}</span>
<br /><!-- END error -->{element}</td></tr>');
$note='<span class="mandatory">(*)</span><span style="font-size:80%;"> Mandatory</span>';
$form->setRequiredNote($note);
$form->addElement('text', 'handle', 'Userid', array('class'=>'text'));
$form->addRule('handle', 'Userid is mandatory', 'required');
$form->addElement('password', 'passwd', 'Password', array('class'=>'text'));
$form->addRule('passwd','Password is mandatory', 'required');
//$form->registerRule('check_pswd', 'function', 'is_pswd_ok');
$form->registerRule('check_pswd', 'callback', 'is_pswd_ok');
$form->addRule('passwd', 'Logon failed', 'check_pswd');
$form->addElement('advcheckbox', 'rememberMe', '', ' Remember me',
array('class'=>'text'), array(false,true));
$form->addElement('submit', 'btnSubmit', 'Login');
if (!$form->validate())
{
$form->display();
}
}
function is_pswd_ok($passwd)
{
global $LU;
//$LU->login($LU->getProperty('handle'),$LU->getProperty('passwd'));
if ($LU->isLoggedIn())
{
return true;
}
else
{
return false;
//$LU->login($LU->getProperty('handle'),$LU->getProperty('passwd'));
}
}
?> |
mysql table:
liveuser_users
| Code: | CREATE TABLE IF NOT EXISTS `liveuser_users` (
`auth_user_id` int(10) NOT NULL AUTO_INCREMENT,
`handle` varchar(50) NOT NULL,
`passwd` varchar(50) NOT NULL,
`lastlogin` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`owner_user_id` int(10) NOT NULL,
`owner_group_id` int(10) NOT NULL,
`is_active` int(11) NOT NULL DEFAULT '0',
`email` text NOT NULL,
PRIMARY KEY (`auth_user_id`,`handle`)
) ENGINE=MyISAM DEFAULT CHARSET=gb2312 AUTO_INCREMENT=3 ; |
_________________ http://www.flyourdream.cn pear class |
|
| Back to top |
|
 |
nucdream
Joined: 30 Oct 2008 Posts: 5
|
|
| Back to top |
|
 |
bubu3k
Joined: 17 Nov 2008 Posts: 1
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|