After writing separate articles on different Zend framework topics, its now time to write a full fledge tutorials. I am starting from a simple sign up and login authentication example and hopefully will discuss some advance topic in future.
So lets get started.
First create a table in your database by executing the following sql query.
CREATE TABLE ‘users’ (
‘id’ int(11) NOT NULL auto_increment,
‘firstname’ varchar(100) default NULL,
‘lastname’ varchar(100) default NULL,
‘email’ varchar(255) NOT NULL,
‘username’ varchar(100) NOT NULL,
‘password’ varchar(15) NULL,
PRIMARY KEY (‘id’)
)
Next create a model against this table in your application/model/ directory. I am creating Users.php and writing the following code in it.
<?
class Users extends Zend_Db_Table
{
protected $_name=”users”;
}
?>
Now create a controller named AuthController.php in application/controllers/ directory and place the following code in it
<?
class AuthController extends Zend_Controller_Action
{
public function loginAction()
{
}
public function signupAction()
{
}
public function logoutAction()
{
}
public function homeAction()
{
}
}
?>