Home arrow PHP arrow Page 2 - Building a Site Engine Using PHP, Part 3

Wanna Go Out on a Data? - PHP

In this third article of the series, Iíll show you how the database and directories should be set up. Iíll also talk about the how to create, install, and use a content block, which mostly relies on arrays and array functions. I'll cover proper authentication methods for such a project so that multiple sites can run off the same users table in the database, while not barring a username from being used on a site because it is being use on another, all the while keeping the authentication accurate and secure from break-ins. (For part 2, see here.)

TABLE OF CONTENTS:
  1. Building a Site Engine Using PHP, Part 3
  2. Wanna Go Out on a Data?
  3. Stop Blocking Me
  4. Insert Username Here
By: James Murray
Rating: starstarstarstarstar / 48
June 28, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

The database is just as easy and logical as the file system -- actually itís a lot easier. The first thing Iíd like to show you is all the different tables, and what they're used for.

Block_location: This table contains all the data that directs the blocks on where to load, when to load, and what site to load on.

Blocks: This table contains all the data for the blockís title, filename, plug-in dependence, module dependence, authentication level, and verification of what site to load on.

Group_users: This table contains all the data that specifies what groups a user belongs to and on which site.

Groups: This table contains all the data that defines the groupís names.

Module_status: This table contains all the data that regulates what modules are initialized and for which site.

Modules: This table contains all the data that specifies a moduleís name, filename, directory, author name, version number, module type, and plug-in dependence.

Plugin_status: This table contains all the data that regulates what plug-ins are initialized and for which site.

Plugins: This table contains all the data that specifies a plug-inís name, filename, directory, author name, version number, plug-in type, and loading priority.

Sites: This table contains all the data that defines each siteís name and host.

Template_users: This table contains all the data that specifies what template is currently being used, and by what user (if users are set up to change their template).

Templates: This table contains all the data that defines each templateís name, site, file, and status.

Users: This table contains all the data that defines each userís name, password, and what site it is registered on.

Here is the actual SQL dump of the site engineís database. If you would like to, can load this into a query and set up your database instantly. For more reference on MySQL tables, definitions, and query syntax please visit www.mysql.com.

# Table: 'block_location'
#
CREATE TABLE `block_location` (

  `bl_ID` int(11) NOT NULL auto_increment,

  `block_ID` int(11) default '0',

  `block_row` int(11) default '0',

  `block_col` int(11) default '0',

  `block_page` varchar(255) default 'all',

  `site_ID` int(11) default '1',

  `user_ID` int(11) default '0',

  PRIMARY KEY  (`bl_ID`),

  UNIQUE KEY `bl_ID` (`bl_ID`),

  KEY `bl_ID_2` (`bl_ID`)

) TYPE=MyISAM;

 

# Table: 'blocks'
#
CREATE TABLE `blocks` (

  `block_ID` int(11) NOT NULL auto_increment,

  `block_title` varchar(255) default 'Block Title',

  `block_file` varchar(255) default '0',

  `plugin_ID` int(11) default '0',

  `group_ID` int(11) default '0',

  `site_ID` int(11) default NULL,

  `mod_ID` int(11) default NULL,

  PRIMARY KEY  (`block_ID`),

  UNIQUE KEY `block_ID` (`block_ID`),

  KEY `block_ID_2` (`block_ID`)

) TYPE=MyISAM;

 

# Table: 'group_users'
#
CREATE TABLE `group_users` (

  `gu_ID` int(11) NOT NULL auto_increment,

  `group_ID` int(11) default '0',

  `user_ID` int(11) default '0',

  `site_ID` int(11) default '0',

  PRIMARY KEY  (`gu_ID`),

  UNIQUE KEY `gu_ID` (`gu_ID`),

  KEY `gu_ID_2` (`gu_ID`)

) TYPE=MyISAM;

 

# Table: 'groups'
#
CREATE TABLE `groups` (

  `group_ID` int(11) NOT NULL auto_increment,

  `group_name` varchar(255) default NULL,

  PRIMARY KEY  (`group_ID`),

  UNIQUE KEY `group_ID` (`group_ID`),

  KEY `group_ID_2` (`group_ID`)

) TYPE=MyISAM;

 

# Table: 'module_status'
#
CREATE TABLE `module_status` (

  `ms_ID` int(11) NOT NULL auto_increment,

  `mod_ID` int(11) default '0',

  `mod_status` varchar(255) default 'not_initialized',

  `site_ID` int(11) default '0',

  PRIMARY KEY  (`ms_ID`),

  UNIQUE KEY `ms_ID` (`ms_ID`),

  KEY `ms_ID_2` (`ms_ID`)

) TYPE=MyISAM;

 

# Table: 'modules'
#
CREATE TABLE `modules` (

  `mod_ID` int(11) NOT NULL auto_increment,

  `mod_name` varchar(255) default NULL,

  `mod_dir` varchar(255) default NULL,

  `mod_file` varchar(255) default NULL,

  `mod_author` varchar(255) default NULL,

  `mod_version` varchar(255) default '1.0',

  `mod_type` varchar(255) default 'public',

  `plugin_ID` int(11) default NULL,

  PRIMARY KEY  (`mod_ID`),

  UNIQUE KEY `mod_ID` (`mod_ID`),

  KEY `mod_ID_2` (`mod_ID`)

) TYPE=MyISAM;

 

# Table: 'plugin_status'
#
CREATE TABLE `plugin_status` (

  `ps_ID` int(11) NOT NULL auto_increment,

  `plugin_ID` int(11) default '0',

  `plugin_status` varchar(255) default 'not_initialized',

  `site_ID` int(11) default '0',

  PRIMARY KEY  (`ps_ID`),

  UNIQUE KEY `ps_ID` (`ps_ID`),

  KEY `ps_ID_2` (`ps_ID`)

) TYPE=MyISAM;

 

# Table: 'plugins'
#
CREATE TABLE `plugins` (

  `plugin_ID` int(11) NOT NULL auto_increment,

  `plugin_name` varchar(255) default '0',

  `plugin_dir` varchar(255) default 'plugins',

  `plugin_file` varchar(255) default '0',

  `plugin_author` varchar(255) default '0',

  `plugin_version` varchar(255) default '0',

  `plugin_type` varchar(255) default 'private',

  `plugin_priority` int(11) default '0',

  PRIMARY KEY  (`plugin_ID`),

  UNIQUE KEY `plugin_ID` (`plugin_ID`),

  KEY `plugin_ID_2` (`plugin_ID`)

) TYPE=MyISAM;

 

# Table: 'sites'
#
CREATE TABLE `sites` (

  `site_ID` int(11) NOT NULL auto_increment,

  `site_name` varchar(255) NOT NULL default '0',

  `site_host` varchar(255) default '0',

  PRIMARY KEY  (`site_ID`),

  UNIQUE KEY `site_ID` (`site_ID`),

  KEY `site_ID_2` (`site_ID`)

) TYPE=MyISAM;

 

# Table: 'template_users'
#
CREATE TABLE `template_users` (

  `tu_ID` int(11) NOT NULL auto_increment,

  `user_ID` int(11) default '0',

  `t_ID` int(11) default '0',

  `site_ID` int(11) default '0',

  PRIMARY KEY  (`tu_ID`),

  UNIQUE KEY `tu_ID` (`tu_ID`),

  KEY `tu_ID_2` (`tu_ID`)

) TYPE=MyISAM;

 

# Table: 'templates'
#
CREATE TABLE `templates` (

  `t_ID` int(11) NOT NULL auto_increment,

  `t_name` varchar(255) default NULL,

  `t_file` varchar(255) default NULL,

  `t_status` varchar(255) default '0',

  `site_ID` int(11) default NULL,

  PRIMARY KEY  (`t_ID`),

  UNIQUE KEY `t_ID` (`t_ID`),

  KEY `t_ID_2` (`t_ID`)

) TYPE=MyISAM;

 

# Table: 'users'
#
CREATE TABLE `users` (

  `user_ID` int(11) NOT NULL auto_increment,

  `user_name` varchar(255) default NULL,

  `user_pass` varchar(255) default NULL,

  `site_ID` int(11) default '1',

  PRIMARY KEY  (`user_ID`),

  UNIQUE KEY `user_ID` (`user_ID`,`user_name`),

  KEY `user_ID_2` (`user_ID`)

) TYPE=MyISAM;



 
 
>>> More PHP Articles          >>> More By James Murray
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: