phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


Zend Framework Login: Preparing Database

Tag: framework, zend, zend framework, authentication, Zend_Auth   Category: PHP Framework
post: 22 Apr 2008 read: 3,212


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

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting