Zend Framework Login: Preparing Database


Zend Framework Login System Step by Step Tutorial - Part 1: Login page is a important part for database application. In this tutorial series, we will talk how to create simple login system at Zend Framework. There are several possible scenario, but I will choose login with database. It means, we need database for store member data.

We still use same database from previous practice. The database name is "zend". Now, create table for store members information. The table name is "users". You can use this query:

CREATE TABLE `users` (
  `id` int(11) NOT NULL auto_increment,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `real_name` varchar(50) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `username` (`username`)
);

Now, try to insert sample member data for example:

INSERT INTO `users` 
(`id`, `username`, `password`, `real_name`) 
VALUES 
(1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Administrator');

Above, we insert a member with user name "admin". Actually, his password is admin. But, for security reason, we use MD5(), so that why, password is stored at database is 21232f297a57a5a743894a0e4a801fc3.

INSERT INTO `zend`.`users` (`id` ,`username` ,`password` ,`real_name`)
VALUES (NULL , 'admin', MD5( 'admin' ) , 'Administrator');

This is screenshot if we use phpMyAdmin.

create user for zend framework login system



Series this article:
Zend Framework Login: Preparing Database
Zend Framework Login: Creating Form Login
Zend Framework Login: Creating Authentication
Zend Framework Login: Fatal error Cannot use object of type stdClass as array
Zend Framework Login: Protected Page
Zend Framework Login: Creating Logout
Zend Framework Login: Creating Switching for Front Page

Bookmark and Share Tag: framework, zend, zend framework, authentication, Zend_Auth Category: PHP Framework Post : April 22nd 2008 Read: 75,295

advertisements


blog comments powered by Disqus