views:

707

answers:

1

Hi all,

I'm starting with the Zend framework and I wanted to use Zend_Auth_Adapter_DbTable to authenticate my users ...

I looked at the docs, which seem quite straight forward, but I'm getting an error.

Here's my code snippet :

$adapter = new Zend_Auth_Adapter_DbTable($this->_dbAdapter, 'users', 'username', 'password', 'MD5(?)');

I have a 'users' table with the 'username' and 'password' columns, but each time I run

$result = $adapter->authenticate();

I get an application error :

Message: The supplied parameters to Zend_Auth_Adapter_DbTable failed to produce a valid sql statement, please check table and column names for validity.

Could anyone help me with this? I just want a basic authentication (the passwords are encrypted using md5)

The weird thing is that the following works ...

$adapter = new Zend_Auth_Adapter_DbTable($this->_dbAdapter); $adapter->setTableName('users') ->setIdentityColumn('username') ->setCredentialColumn('password') ->setIdentity($username) ->setCredential(md5($password));

but why does the "setCredentialTreatment" (or using it as in the first code snippet) method fail ...

is it because i'm using sqlite3 and not mySQL???

Thanks

+3  A: 

Looks like it. For using MD5() in SQLite you need Tcllib and Trf.

Franz
Thanks Franz :)
just_a_dude