SlideShare a Scribd company logo
Running Header: DEVELOPING A WEB BASED CMS USING PHP
Developing a Web Based Content Management System Using PHP
By:
Adam M. Erickson
Requirement for Degree:
Masters of Science in Information Systems Management
Ferris State University, 2012
Advisor:
Dr .Douglas L. Blakemore
Full Professor
Accounting, Finance, and Information Systems Department
Fall Semester 2012
Ferris State University
Big Rapids, MI
DEVELOPING A WEB BASED CMS USING PHP 2
Copyright: 2012, Adam M. Erickson
All Rights Reserved
DEVELOPING A WEB BASED CMS USING PHP 3
DEDICATION
I dedicate this to my wonderful family. Particularly to my children, Scarlett, Charity,
Azreal, and Micah, for they have brought fulfillment to my life. I must also dedicate
this to my parents, who have helped me along the way and have given me their full
support. Finally, I dedicate this work the late ones I love that have passed away, they
have helped guide my actions through life by there leadership, faith, and kindness.
DEVELOPING A WEB BASED CMS USING PHP 4
ACKNOWLEDGEMENTS
I would like to thank all of those people who helped make this thesis possible.
I wish to thank my advisors Professor Dr. Barbara Ciaramitaro, Professor Gerald
Emerick, and Professor Dr. Doug Blakemore for all their guidance, encouragement,
support, and patience. There sincere interests in information systems management and
my education have been a great inspiration to me.
DEVELOPING A WEB BASED CMS USING PHP 5
TABLE OF CONTENTS
Page
LIST OF TABLES.......................................................................................................................................................6
LIST OF FIGURES .....................................................................................................................................................7
ABSTRACT .................................................................................................................................................................8
CHAPTER 1 INTRODUCTION ..............................................................................................................................9
CHAPTER 2 BACKGROUND AND LITERATURE REVIEW ....................................................................13
CHAPTER 3 RESEARCH MATERIALS AND METHODS...........................................................................18
CHAPTER 4 DETAILS OF RESEARCH ............................................................................................................22
CHAPTER 5...............................................................................................................................................................38
REFERENCES...........................................................................................................................................................42
APPENDICES............................................................................................................................................................45
CURRICULUM VITAE...........................................................................................................................................67
DEVELOPING A WEB BASED CMS USING PHP 6
LIST OF TABLES
Page
Table 1: Search strings used........................................................................................... 19
Table 2: Requirements ................................................................................................... 20
Table 3: Main Folders in Directory ............................................................................... 29
DEVELOPING A WEB BASED CMS USING PHP 7
LIST OF FIGURES
Page
Image 1: MySQL Command Line Client.......................................................................... 24
Image 2: phpMyAdmin..................................................................................................... 25
Image 3: WampServer options.......................................................................................... 26
Image 4: Eclipse for PHP Developers .............................................................................. 27
Figure 5: MVC .................................................................................................................. 30
Figure 6: User Table ......................................................................................................... 31
Figure 7: CSS ID Tags...................................................................................................... 33
Figure 8: CSS link............................................................................................................. 33
Figure 9 index.php ............................................................................................................ 34
Figure 10: PHP Login Form ............................................................................................. 35
Figure 11: HTML Login Form ......................................................................................... 35
Figure 12: PHP to Check for SQL injection ..................................................................... 36
Figure 13: PHP to Check if User Exist ............................................................................ 37
Figure 14: Final Front End Look ...................................................................................... 39
DEVELOPING A WEB BASED CMS USING PHP 8
ABSTRACT
The Content Management System (CMS) is a web based application using a Linux
Server, Apache Web-server, MySQL Database, and PHP Programming Language
(LAMP). It is intended for managing user, and information in any given web
environment that is only hindered by imagination. The main objective of this application
is to begin the initial development of a CMS by creating the building blocks for
developing and taking into consideration basic methods for creating the base platform of
a CMS for further development. All information gathered, and experience gained will
help with developing and offering my own personal e-commerce business solutions in the
future and gain further business and technical understanding for future employment and
dissertations in free open source software and e-commerce.
DEVELOPING A WEB BASED CMS USING PHP 9
CHAPTER 1 INTRODUCTION
Working with several different Content Management Systems (CMS) to adapt to
one specific CMS within Open Source Software (OSS) like Joomla, Xoops, Wordpress,
Drupal, Zend Cart, OS-Commerce, and/or any other web-based CMS can be stressful.
Trying to create an acceptable theme and/or manage plug-ins so each CMS works the
way they are needed and not the way the developers initially intended for a company
requesting it, or for personal use, can result in an unfruitful endeavor into application
development. When you are adapting to some other developers intended business model,
it never seems to have the exact requirements that a company is looking for. Given that
there is a proper amount of time, it would be much easier to create a core CMS from
scratch. This would allow for a company to design and develop a solution that would
offer exactly what an organization requires. Regardless if it is for a simple business report
or if it is used for an Intranet or intranet site, if the solution is allowing for specific
customizable functional and aesthetic designs during development of a websites that is
best suited for any organizations’ web based needs, it will have a significant better
chance of being adopted.
1.1 BACKGROUND OF THE PROBLEM
DEVELOPING A WEB BASED CMS USING PHP 10
Applications for CMS’s have been developed within a number of commercial and
free software communities that are available to users is ever increasing because of the
availability of newer technology, and the increasing demands of what user requests. The
basic approach, in project management terms, is that what a user wants is a great product,
that is cheap, and they want it yesterday. Developing a web site can take a few months to
a few years when you have to factor in design, aesthetics, and functionality. While it can
take a lot of man hours to complete, there should be little to no overhead in software costs
to users because licensing costs after initial development should be of little concern. By
designing a system from scratch, an organization has the ability to utilize all the latest and
greatest technology that is available and mold the system to fit their company’s
requirements.
1.2 STATEMENT OF THE PROBLEM
Therefore, the problem addressed in this study is the ability to create a CMS from
the core requirements for organizations using all OSS technology with an emphasis on
being open object oriented within a Model View Control/agile framework, to deliver a
web based application that will meet the needs of a company and be easily to modify in
the future.
1.3 OBJECTIVES OF THE STUDY
The objective of this exercise is to finish the beginning stages of development and
start the initial programming on a core, PHP driven, website that will allow for additional
plug-ins. Because there will be a better understanding of the underlying foundation that is
being used, any modifications, wither functional or aesthetic, designing will be easier to
DEVELOPING A WEB BASED CMS USING PHP 11
comprehend. Additionally, the final completed core CMS may be used for educational
purposes.
1.4 RATIONALE FOR THE STUDY
By researching design a core CMS using current application design methodology
using a Linux, Apache, MySQL, and PHP, for an HTML, JavaScript frontend in order to
better define current best practices used for content management systems.
1.5 NATURE OF THE STUDY
The nature of this study will be comparative analyses of best practices in web
development when building the core system of a content management system, and project
to define and design a core content management system using PHP, JavaScript, HTML,
and MySQL on Apache, using a Linux server.
1.6 DEFINITION OF TERMS
CSS - Cascading Style Sheets helps format the look and feel of an HTML document
through presentation semantics.
CMS - Content Management System is a computer program that allows publishing,
editing and modifying content within the application.
CRUD - Create, Reuse, Update, Delete are the four basic functions of a persistent storage
application.
HTML - Hypertext Markup Language, the main language for displaying web content in a
web browser.
IDE - Integrated Development Environment, a program to facilitate the complexities of
developing large programs.
DEVELOPING A WEB BASED CMS USING PHP 12
ISS - Internet Information Server is the web server that comes pre-packaged within
windows servers.
JavaScript - A scripting language that is usually implemented within a web page to add
more functionality and user enhancements.
LAMP - A term used for the platform of servers that host a web application a LAMP
stack consists of a Linux, Apache, MySQL, and PHP server.
MVC - Model View Control, is an architecture model for separating different interactions
within a program.
OOP - Object Oriented Programming, using class object to pull instances of a section of
code when necessary using techniques like inheritance to separate classes logically.
PHP - Hypertext Preprocessor, a server side embedded scripting language.
WAMP - A term used for the platform of servers that host a web application a WAMP
stack consists of a Windows Apache, MySQL, and PHP server.
XML - Extensible Makeup Language is a markup language that helps define the rules for
encoding documents.
1.6 ASSUMPTIONS AND LIMITATIONS
While most people prefer to save money, there is sometime a need for speed or
the inability to give time to web developer finance a truly free solution that fits business
needs. There is several information that can be gleamed from the web on how to develop
the web but not so much in academia and public libraries that is up to date and available.
DEVELOPING A WEB BASED CMS USING PHP 13
CHAPTER 2 BACKGROUND AND LITERATURE REVIEW
The Internet is constantly evolving since its humble beginnings as ARPAnet, a
government funded communications network, back in 1969 (McKenzie, 2011) with
additional help from researchers, academics, and companies like AT&T (Crovitz, 2012).
In the beginning it was just a textual messaging system and requirements grew with
demand to be able to markup the language with formatting to make it easier to read and
visually appealing with the aid of Hypertext Markup Language (HTML). The Internet
evolved with a need for more interaction from users in a graphical user environment.
Web pages could not be static anymore as business pushed for the ability to do more than
provide information and actually be able to offer online sales and services with
interactive pages using methods like JavaScript, Adobe Flash and/or Dynamic-HTML. A
most significant change in how we use the Internet was the introduction of server-side
scripting languages. Server-side scripting languages gave developers the ability to take
dynamic web pages and create transactional-oriented web pages. Server-side scripting
languages that have been widely used in production have included Oracle’s Java Server
Pages (JSP), open source Perl, Microsoft’s Active Server Pages (ASP), and the open
source Hypertext Preprocessor (PHP), (Suraski, 2002). These scripting languages allow
DEVELOPING A WEB BASED CMS USING PHP 14
access to data bases, and opened the way for how we use the Internet today with
electronic commerce (e-commerce). The popularity of Open Source Software (OSS)
when developing web pages has continued to grow. The real hold out on why more
professional do not implement OSS is because of it not being as mature as some
proprietary software and it lacks the marketing initiative that proprietary providers have
invested in (Gittens, 2007).
2.1 OPEN SOURCE SOFTWARE
OSS is a set of practices used to collaborate with software source code that has
been made freely available through copywriting laws. OSS can come from individuals
separated by diverse cultural, corporate boundaries, language and other characteristics in
order to work together to create complex, non-proprietary software. Software is open
sourced when it is free to redistribute, the source code is redistributed with it as well as in
compiled mode. The open source licensing was created to make the source code of a
program readily available to anyone that requests it. OSS protects the original author of
the software, does not discriminate in anyway on how it can be used, cannot be specific
to a product or software, cannot restrict other software and has to be technology neutral
(open source, n.d.).
Open Source Software (OSS), is the most viable solution for creating a CMS
because of its popularity, performance, and cost effectiveness. As of September 2012,
Sourceforge.net’s website proudly boasts numbers of 3.4 million open source developers
working on over 324,000 OSS projects with an average of 4 million OSS downloads per
day. Most popular OSS software that can be easily obtained and utilized on the Internet
DEVELOPING A WEB BASED CMS USING PHP 15
is the Linux OS (Operating System), Apache Web Server, MySQL Database, and the
Hypertext Preprocessing Language (PHP). There are several other applications that can
be used to develop websites but the grouping listed has grown in popularity to have there
own acronym LAMP and is covered on almost all popular web hosting sites while other
open source software like Java and the Tomcat Java Server are rarer and usually cost a
significant amount more to run a web based platform from.
Some of the more widely known open source licenses cover the GNU(Graphical
Environment of Linux Servers and Desktops), Mozilla (Firefox, Thunderbird), MIT,
BSD (like Unix), and Eclipse (Eclipse IDE). Because of the lack of dependency on
software vendors, open source software allows the software to transform and morph into
potentially anything the users and developers need the software to do.
2.3 APACHE WEB SERVER
Apache the HTTP web server is continuing to be one of the most popular web
servers for hosting web content. Wither it is in commercial or open source terms (Open
platforms, 2012). Apache Web Server is the 1995 collaborative project that offers the
source code for free to the HTTP Web server (Apache, n.d.).
2.4 MYSQL DATABASE
MySQL is the world’s most popular database and is powering some of the largest
companies online, including Facebook, Google, Amazon, and Yahoo (Henschen, 2011).
Its impressive combination of fast SQL queries with access to the source code for free
has made it another success like Apache and PHP with over sixty five thousand
downloads per day (Mysql, n.d.).
DEVELOPING A WEB BASED CMS USING PHP 16
2.5 PHP: HYPERTEXT PREPROCESSOR
The hypertext preprocessing language (PHP) is an open sourced product that
lacks the marketing power from companies like Adobe Flash and Oracle’s Java. It is a
server-side multi-platform, scripting language that can be embedded within HTML.
Unlike JSP (java server pages), and ASP (active server pages), PHP has its own language
and is strongly acknowledged with Apache but can work with other Web servers (Kevin,
2002). Thanks to companies like Red Hat and Zend, the popularity of PHP is increasing
as they offer built in platforms that offer support for PHP developers (Red hat, 2012).
Some of PHP’s strengths are that it is very fast and can serve millions of hits per day.
PHP is free so that it can inexpensively be deployed in horizontal scaling in a large
number of servers. PHP can be integrated with many database systems within the PHP
libraries, there is also built in libraries for common Internet tasks like parsing XML,
sending email, working with cookies, generating PDF documents, and all with just a
small amount of additional code. Other reasons that PHP is growing in popularity is its
portability between systems, the flexibility of development approaches, the similarities
between Java and C programming, and availability of supporting documentation and
support (Welling & Thomson L, 2009).
2.6 INTEGRATED DEVELOPMENT ENVIRONMENT
For every programming language out, eventually an IDE (integrated development
platform) is released to help structure and order the code blocks for any given complex
application. Several commercially paid and free versions exist for PHP that can be either
downloaded for free or purchased. A couple of the most popular IDE’s are Zend Studio’s
DEVELOPING A WEB BASED CMS USING PHP 17
Eclipse version and PhpStorm. Zend Studio is from the creators of PHP and best for
developers who are already familiar with Eclipse or IBM’s commercial version Rational
(Wayner, 2012).
2.7 MODEL VIEW CONTROL
In the classic MVC (model, view, control) methodology, the controller is
basically the mediator between the user’s actions through the view of the user interface.
In the case of web development, this would be the web browser, and the domain logic,
calls to the database, is captured in the model (Shaw, 2012). MVC methodology is
already being used in some of the competing software for PHP’s like ASP. Where
Microsoft has already incorporated the MVC into one of there platforms called ASP.Net
MVC 4 (Krill, 2012).
DEVELOPING A WEB BASED CMS USING PHP 18
CHAPTER 3 RESEARCH MATERIALS AND METHODS
The project is to implement a core content management system using PHP,
HTML, and JavaScript-languages with MySQL database, Linux CentOS and Apache
servers. It will be used as launching ground to discover today’s best practices in web
development and security when developing an interactive website. My research questions
will be answered through the implementation of the project model.
3.1 RESEARCH QUESTION
How to build a core CMS with best practices implemented using PHP, MySQL
and HTML?
3.2 METHODOLOGY
Methodology to answer the research question will be using qualitative analysis
and synthesis of other people’s research to discover information useful to implement a
project model that will be utilized to analyze my project as part of the project.
In order to answer my stated research question I will be conducting a comprehensive
search for relevant studies and literature reviews found in different stages and using the
following sources:
− Google Scholar
− Google
− ABI/IFORM Global
− Current books available in web development, PHP, and CMS
DEVELOPING A WEB BASED CMS USING PHP 19
Collected information on studies that examine the research question will be analyzed
for data from acceptable studies and decisions. A report will be provided highlighting
implications and alternative solutions when available. Popular CMS sites (Wordpress,
Drupal and Joomla) will be analyzed to determine design factors like the directory
structure on the server and development of SQL tables.
Research will include search strings like “PHP web development evaluation”, “PHP
MVC templating”, and “comparison of PHP4 and PHP5”. There were several other
results that were found but few that were relevant because they were to general or did not
cover the stated research question.
Common used search strings can be found in Table 1.
Search Strings Used
PHP5 web development
Comparison of PHP4 and PHP5
PHP MVC web development
PHP CMS web development
Web development best practices
PHP best practices
PHP framework evaluation
CMS best practices
MySQL and PHP
Table 1: Search strings used
In order to implement a solution for creating the content management system
using popular and available technology, common development solutions will be
evaluated and compared against other development resources. All development coding
and resources must be able to work within the testing environment.
DEVELOPING A WEB BASED CMS USING PHP 20
Once completed, checks will be made to make sure that it can be implemented on
a LAMP web hosting platform, and security measures are in place. Below in Table 2 is a
list of the server information requirements that will be used as a testing environment for
my research.
System Requirements
Name/Version Comments
Linux x86 CentOS 5.5 Sever
Apache 2.2.21 Web server
JavaScript Validation
PHP 5.3.10 Coding
MySQL 5.1.52 Database
Table 2: Requirements
Model View Control methodology will be a part of the process and will prove that
PHP can be used for the modeling and the viewing without the need of a templating
engine.
The stable release of PHP is an acceptable practice with several of the security
options that were not covered in previous releases. The release of PHP5 has many
security and development improvements that will be utilized within the CMS
development stages. Comparison on programming and security will be taken from the
developer’s website along with publications and well established developing websites
within the web development community.
To define what applications should be used for developing websites with PHP, I
will be comparing and contrasting the most commonly used methods. Conclusion based
on my own experience and what is available through online discussions will allow me to
come to my own conclusions.
DEVELOPING A WEB BASED CMS USING PHP 21
3.3 MILESTONES
1. Determining what software, by criteria, can be leveraged to develop a PHP
website
2. Directory Structuring on the server for security and manageability of code
3. Determining if there is a need to use a templating engine
4. Example SQL syntax
5. A HTML5 structuring with CSS3 template for a welcome page
6. Example PHP coding for user management
DEVELOPING A WEB BASED CMS USING PHP 22
CHAPTER 4 DETAILS OF RESEARCH
4.1 INTRODUCTION
Running through several sites and books it took several attempts and failures to
select the correct methods of creating a simple content management site that uses PHP5,
CSS, and HTML. Several options are available for creating a site and the hardest steps to
decide are the beginning ones. Having the correct PHP, web-server, and database settings
took the longest time. Afterwards weeks were spent deciding on how to structure the
web directory and creating the user login requirements for the actual site.
4.2 APPLICATIONS
The main constraint for development of my CMS is cost, every tool that is
available, I want available to anyone with access to a computer and the Internet to be able
to duplicate my choices. The second constraint is popularity because the more popular the
tool, the more options, references, and communities on the Internet are available as well
as webhosting sites that offer the same solutions I propose. The reasoning for keeping
things free is to promote others to develop on the same framework in order to educate and
help create future developers who may not believe they have the tools on hand because
some of the other most talked about frameworks take a lot of money or education to
DEVELOPING A WEB BASED CMS USING PHP 23
begin developing within. One of the most expensive IDE’s would be for Microsoft C#
and even less expensive programming languages like Java still require a considerable
more amount of education and web-hosting costs for a Tomcat web-server to be
available. Most web hosting companies offer a LAMP stack for development web pages
and some of the most popular content management systems like Joomla, Drupal, and
Wordpress also use the LAMP stack because it is FOSS (free open source software). This
is the reasoning that I have chosen to develop my CMS. To develop around software that
is easily accessible, free to use and distribute, with a large community base online for
referencing and help.
In order to develop a PHP system you have to have the services present to work
with PHP. The PHP server can be installed on Apache or IIS (Internet Information
Server) Web Servers, it was created to run strictly with Apache and when used in
conjunction with IIS has been known to created problems and further editing of
configuration files are necessary for it to work correctly with IIS. Once a web-server is
installed there is also a need to create dynamic page content, based on users that come to
your site.
In order to track and monitor users, and modify page content based on what a user
wants, it is necessary to have some sort of way to easily and quickly save and access
information. This is where SQL (Structured Query Language) databases come in, because
of the amount of information that can be quickly accessed as a system grows by a SQL
server. Data is more easily to structure and also to secure with SQL. Just about any
database can be accessed and modified through PHP including MS-SQL, Oracle, and
DEVELOPING A WEB BASED CMS USING PHP 24
DB2. MySQL (www.mysql.com) is judged to be the most popular to use because it is
free to use and download, it is one of the very few databases that are offered by
webhosting companies for no additional charge, and there is a free web based graphic
environment plug-in to modify the MySQL database. With out a web GUI (graphical user
interface) user are constrained to only the default command line tool for MySQL pictured
below in Image 1.
Image 1: MySQL Command Line Client
PhpMyAdmin (http://www.phpmyadmin.net) is a free tool written in PHP that
helps handle administration of a MySQL server by offering support through a wide range
of operating inside a MySQL server. SQL operations that can be used through he user
interface can help in managing databases, tables, fields, relations, indexes, user
permissions and even execute directly to the MySQL server SQL syntax statements. The
below Image 2 displays a few options of how phpMyAdmin is viewed compared to the
command line tool offered with MySQL.
DEVELOPING A WEB BASED CMS USING PHP 25
Image 2: phpMyAdmin
Because I do not want my trial and errors seen by anyone on the Internet I have
postponed moving my development to the Internet until next year. If all things go well I
will move all my Wordpress documents to my own personally built CMS. Until then I
need to have a system available to mirror the options that I would have with a web
hosting site like Hostgator.com and GoDaddy.com. This means selecting software that
can run on my computer. A WAMP (Windows, Apache, MySQL, and PHP) server that
could run on a Windows 7 platform and give me all the options that I would expect from
an LAMP web-serving host would need to be chosen. Two of the most popular software
that is available for free downloads are XAMPP, and WampServer. XAMPP for windows
offers several options including an FTP server, Tomcat server for Java, and Perl.
WampServer offers just the basic functions I was looking for; an updated version of PHP,
Apache and MySQL. XAMMP was not as easy to configure as it wanted to install
DEVELOPING A WEB BASED CMS USING PHP 26
Apache and MySQL as services on the computer which was very volatile because of the
security settings in Windows 7. The configurable settings seen below in Image 3 for
WampServer worked flawlessly and were very simple to configure. A version to
download can be found at this link: http://www.wampserver.com/en/.
Image 3: WampServer options
With financial limitations of several potential developers in the world including
this author, I have chosen to go with a free Integrated Developing Environment Platform
(IDE) because developing a system as extensive as a CMS, would be very complicated to
develop using only text files, an IDE can be very useful. One of the most popular IDE’s
that is also extensively used for Android development, Java, XML, and PHP is Eclipse.
Eclipse, shown below in Image 4, is the free version of IBM’s Rational IDE that was
released to the public as open source software to further promote the development of
Rational. In the several years since Eclipse’s release there have been several different
versions released. With the right plug-ins, it allows users to see syntax highlighting, can
DEVELOPING A WEB BASED CMS USING PHP 27
help with code completion, navigation, errors and warning highlighting, debugging,
refactoring and code generation. It is used by individuals and companies world wide.
Image 4: Eclipse for PHP Developers
The other popular IDE for PHP development is NetBeans by Oracle. NetBeans
and Eclipse are both downloadable for free but Eclipse is what I have been training on for
years. In the end it is mostly a decision that is made personally. Both products offer the
same functionality. Zend (www.zend.com) offers the free download for Eclipse with PHP
debugging. NetBeans can be downloaded for free at: www.netbeans.org.
DEVELOPING A WEB BASED CMS USING PHP 28
4.3 FOLDER HIERARCHY
Once software is determined it is still not time to start programming yet. As a
CMS grows, so does the amount of data that will be managed. Having a simple way to
manage all the different types of files is important. Building a directory structure that
makes browsing and storing information easier for the developer is very helpful. In order
to determine how information will be partitioned into a directory structure can also help
to create security checks on objects that are created in a CMS. Knowing that everything
that an administrator can do is all located within an administrator file makes it less of a
hassle to determine what should be seen and what should not. It also allows determining
what rights certain files should be had, if they should be read, write or execute only. For a
designer on a CMS project it helps determine what files should be worked on from ones
that should be left alone.
A directory structure can be very subjective but should make sense to everyone
that will be using it, the programmers, and designers. In the below table, is the basic
folders that have been designated for use building the CMS. While not all are used at the
moment is a good practice to expect growth in are programming in the future and to make
room for it. Table 3 below illustrates the folders with the logical reasoning for choosing
these folders.
Folder Name Folder definition/Reasoning
admin The place to configure all website maintenance
cache Used to store previously used views so that PHP does not have to build the
code from scratch again and database queries.
classes When implementing personalclasses for OOP, this is internal classes would be
stored.
components Major extension, a complex display that can be broken up into less complex
components.This is how MVC can be broken up.
DEVELOPING A WEB BASED CMS USING PHP 29
configs Stores additional configuration settings
editor Can be used to store an external WYSIWYG editor.
extClasses Classes created by others that may be added to the CMS.
help A place to save all help files. Proper documentation here can help a lot in the
future.
images A place to store uploaded images.
includes Functions and otherfiles that handle the arrangement and management of data
besides the classes and components.
media Like the editor folder, media is for editing and management media.
modules Minor extensions that create small screen boxes with useful information like
who is online but not necessary like components.
params Static parameters for some functions and classes can be stored here for easy
access.
templates Besides for the admin templates this folder will hold all the othertemplates for
changing the look of the CMS through HTML, JavaScript, and CSS
Table 3: Main Folders in Directory
Folders below the main folder are created to help differentiate certain sections
from other. One example is the admin folder. The admin folder maintains its own
modules, components, help files, media, editor, and template files to make it easier for a
programmer to differentiate between user access and admin access areas. Within
components there is a separate folder within each component. Under the component for
users there are three folders used to create a MVC that will be necessary for separating
design, from the data, and the controllers that are called upon the data. A visual
representation of the hierarchy in a folder view is located with in appendix B,
4.4 MVC AND TEMPLATING
As discussed, because code can start to become very complex as the project grows
it becomes more and more important to separate business logic and presentation data
separately. The Model will contain the methods used to call on the database and make
add, remove update calls to the database. The Controller is responsible in the application
of holding all other PHP that does not manipulate data like answering requests from the
DEVELOPING A WEB BASED CMS USING PHP 30
user and calling on the model to manipulate the data. The View is the part of the
programming that will render the HTML. The View is commands called from the
controller that requested methods from the Model are displayed through rendered HTML,
JavaScript, CSS and/or images as seen in the below Figure 5.
Figure 5: MVC
While using a templating engine along side of the View can help in separating
display logic and actual business logic, a good PHP programmer should be able to
separate the two in separate files without needing a templating engine that would be one
more step of coding that would need to be learned in order to develop the CMS and an
additional dependant on the functioning of the CMS if the templating engine stopped
being supported. While a templating engine looks good in paper, I have come to the
conclusion that it is an unnecessary step in creating a CMS. PHP’s history started out as
being a templating engine. I do not see the reasoning for needing to add another
processing layer to the PHP code when PHP is still very capable of templating on its
own. You just have to make sure that you are upholding to the MVC methodology and
keeping any PHP that deals with only viewing information in the Viewing folder of the
systems components.
DEVELOPING A WEB BASED CMS USING PHP 31
4.5 DATABASE
Creation is important to define before encoding, if no done right it can hinder the
ability of the programmer to write good code. Take for instance the ability of PHP to take
a password form a form and have it transformed into a MD5 128-bit hash value before
passing it into the database. A 128-bit hash requires 32 characters in a database field to
work, if you did not set up your database to store a 32 character password, it would fail
from the beginning. Another to take into consideration is types of data fields that may be
created in the near future. While the database can always be changed later, if the fields
are already available, it takes away some of the unnecessary time of re-visiting you
database to make corrections and fixing additional mistakes you may make when
modifying the database.
MySQL SQL syntax is very similar to other databases, offering the standard data
types to choose from. The below Figure 6, it displays the values set for the user table of
my database.
Figure 6: User Table
DEVELOPING A WEB BASED CMS USING PHP 32
As you can see I did not use a 32 character data set for my password field. I
preferred to leave it open to 255 variable character data set, in case I change my mind on
how to handle passwords in the future, I will be able to do it without forcing a person into
resetting there password the next time they visit the site. Not all fields are being used; the
fields that are being used are the id, userName, and password. As the CMS is developed
the other fields will be used to better track users by knowing the amounts of times they
have tried to log in, to send emails for password reset, see if they are active, promote the
user to the admin group, and view additional information on the last actions they had
while on the site as well as how long they stayed on the site.
4.6 HTML5 & CSS
HTML5 is the new standard for hypertext markup language. It offers the ability to
support CSS3 completely and offers new elements and attributes. In order to understand
how I have created my index.php, the first page of the site, you need to understand the
basics of how HTML can be used. The standard blocks used in most of an HTML5 page
in are viewed in the next figure, Figure 7.
DEVELOPING A WEB BASED CMS USING PHP 33
Figure 7: CSS ID Tags
By using the <div> tag and assigning different id’s to the <div> tags, it allows to
structure the theme from a single file in the CSS (content style sheets) that is link to the
index page using the below HTML code example displayed in Figure 8.
Figure 8: CSS link
4.7 PHP CODE EXAMPLES
DEVELOPING A WEB BASED CMS USING PHP 34
It is important to have a general example of how the HTML blocks are located
within the CMS so that the way the PHP programming can be better understood. Using
the include_once command you can separate logical parts of code and html sections.
Figure 9 below, displays how the command is used in the index.php page that is viewed
by linking several different pages together from within the CMS directory.
Figure 9 index.php
DEVELOPING A WEB BASED CMS USING PHP 35
Line 6 in index page above is used to store user information while they are on the
CMS. Line 8 checks to see if the user as logged in if they are it prints a welcome
message at the top of the screen, and if they are not logged in directs them to the login
page. The login page is broken into several different PHP pages. The first page called
login.php shown below in Figure 10 contains the form necessary to login.
Figure 10: PHP Login Form
The PHP has been ended and normal constructs of a simple HTML form shown
below in Figure 11 is passed to the browser will the POST function of the HTML from is
sent to PHP through session variables to be used against the database for authentication.
Figure 11: HTML Login Form
DEVELOPING A WEB BASED CMS USING PHP 36
The user enters in their user name and password and select log in, which send the
information to auth_user_fns.php script that includes the database_fns.php script used to
connect to the database and then scrubs the user name and password fields as a security
check so that SQL injection doesn’t occur as seen in the below Figure 12 using the
commands stripslashes and mysql_real_escape_string.
Figure 12: PHP to Check for SQL injection
Next the user name and password are checked against every user
name in the database until it finds one match and only one match. Then the PHP code
marks the user as a valid user and directs them to the index page where they can begin
browse or modify pages based on there rights the coding is shown in the following Figure
13.
DEVELOPING A WEB BASED CMS USING PHP 37
Figure 13: PHP to Check if User Exist
Additional PHP examples, database entity relation database, CSS sections can be
found in the appendices for further information on how I have developed the initial CMS.
DEVELOPING A WEB BASED CMS USING PHP 38
CHAPTER 5
SUMMARY
While CMS sites are comparatively simple to use once created, I do want to note
that initial installation, development, and configuration will be more difficult than just
throwing a few PHP, CSS, HTML and JavaScript elements together. Most developers
have focused experience on either front-end or back-end development because of all the
necessary steps to build a web based information architecture that is secure and free of
bugs. Anyone that takes on the action of creating a fully functional CMS would likely
want to have an extended network of colleagues to collect best know practices and other
additional programming knowledge. Any one who endeavors to create a CMS on the web
using a commercial website hosting company should look for a hosting company with
interfaces for easy installment and management MySQL and PHP plug-ins. Before PHP
and HTML can be fully utilized, there is a learning curve for configuring and setting up
Apache, PHP, and MySQL configurations and security. Using PHP you can design a
wide range of Internet websites. The developer of an interactive website will have to
make many decisions about what functionality and user interfaces to use and allow.
DEVELOPING A WEB BASED CMS USING PHP 39
The following Figure 14 displays how my first build of the website will look like
from the front end.
Figure 14: Final front end view
5.2 CONCLUSION
Any web development project does take a high level of experience in many
different areas. Building a large scale CMS is like building a house. It would take a very
long time and a lot of training for only one person. Most successful large scare web
managed systems are developed within teams and other discussion groups and teams.
Unlike other programming languages that run through a compiler before being shipped to
the client, PHP source code is available for the client to open up and take advantage of a
DEVELOPING A WEB BASED CMS USING PHP 40
programmers code to further there own work. This could be looked at as either and
advantage for promoting sales or a disadvantage because you can not secure the code
after distributing a project to a client.
PHP is primarily a web development language with many abilities within
the core and additional libraries not covered. Because it is primary a web development
tool a good understanding of other technologies like Bash, Cron, Perl, CSS, JavaScript,
and HTML are necessary in order to deliver a commercial product.
Coming into this project I would define myself and a intermediate web developer,
with future study and implementation of different methods of PHP coding, security and
functioning sites that offer users different services, I will be able to become and expert in
the field. There are several different reasons why I have selected this topic. Future work
is to created documentation for publishing that can help to educate students on how to
develop interactive web pages that follows object orientated programming (for advance
classes) using best known practices in World Wide Web and information architecture.
Once the base system is created it can be utilized to create any type of system
available in today’s market. Some of the applications can be envision and created can be
a document repository system, client management system, online sales management
system, a company’s intranet and/or Internet site.
5.3 SUGGESTIONS FOR FURTHER STUDY/WORK
Future work that will add functionality to a CMS and also incorporate further
study could also include introducing the PEAR library framework of reusable PHP
components that offer the ability to for PHP that comes with great functionality for PHP
DEVELOPING A WEB BASED CMS USING PHP 41
developers like the ability to authenticate to many different types of operating system
authentication servers. This would be very useful because companies ask that any new
applications use the same single sign on for security that they are already using. Wither it
is works with Active Directory, Radius, LiveUser or OpenID. Additionally the PEAR
library offers prepackaged code that will manage XML, caching, event handling, file
systems, logging, mail, math, numbers, and other functions that are found in other
programming languages like Java yet tailored specifically for web applications and web
service like Amazon.
Besides just learning about the technology that drives a web page there is also the
need to know how to create an aesthetic views, and applications that work the way a
client expects. The ability to create information architecture that will be used is
imperative. The technology and methods that drive the Internet are numerous and there is
always a new way to skin a cat being presented every year it seems. Make sure to stay
involved with discussion lists, professional associations, books and journals available
online or at the library that deal with application development.
DEVELOPING A WEB BASED CMS USING PHP 42
REFERENCES
Apache. (n.d.) HTTP Server Project. What is the Apache Server Project Retrieved from:
http://httpd.apache.org/ABOUT_APACHE.html
Bernstein, M. (2002). 10 tips on writing the living Web. A list apart: For people who
make websites, 149. Retrieved from http://www.alistapart.com/articles/writeliving
Bonaccorsi, A., & Rossi, C. (2003). Why open source software can succeed. Research
Policy, 32(7), 1243-1258. Retrieved October 24, 2011, from ABI/INFORM Global.
(Document ID: 405243571).
Crovitz, G. (2012, July 30). Information Age: WeHelpedBuildThat.com. Wall Street
Journal (Eastern Edition), p. A.11. Retrieved August 15, 2012, from ABI/INFORM
Global. (Document ID: 2723545181).
Feldman, D. A. (2006, April). Understanding open source: Part 2. KM World, 15(4),
20,22,24. Retrieved October 24, 2011, from ABI/INFORM Global. (Document ID:
1021576011).
Gittens, C. (2007, March). Open source is still fighting against fear. Computing Canada,
33(4), 25. Retrieved August 15, 2012, from ABI/INFORM Global. (Document ID:
1252213981).
DEVELOPING A WEB BASED CMS USING PHP 43
Henschen, D. (2011). Why all the HADOOPLA? InformationWeek, (1316), 19-20,22-
24,26. Retrieved from
http://search.proquest.com/docview/904423979?accountid=10825
Kevin, F. C. (2002). PHP: An open source solution for web programming and dynamic
content. Information Technology and Libraries, 21(3), 116-120. Retrieved from
http://search.proquest.com/docview/215832480?accountid=10825
Krill, P. (2012). Microsoft upgrades ASP.net MVC to enable faster-loading web apps.
InfoWorld.Com, Retrieved from
http://search.proquest.com/docview/923642873?accountid=10825
McKenzie, A. (2011). INWG and the Conception of the Internet: An Eyewitness
Account. IEEE Annals of the History of Computing, 33(1), 66-71. Retrieved August
15, 2012, from ABI/INFORM Global. (Document ID: 2286554181).
MySQL. (n.d.) Market Share. Retrieved from: http://www.mysql.com/why-
mysql/marketshare/
Open platforms will win cloud race: Citrix. (2012, Nov 19). The Business Times.
Retrieved from http://search.proquest.com/docview/1170523431?accountid=10825
Open Source. (n.d.) The Open Source Definition. Open Source Initiative. Retrieved from
http://www.opensource.org/docs/osd
Red hat expands OpenShift ecosystem with zend partnership to offer professional-grade
environment for PHP developers. (2012, Oct 09). Business Wire. Retrieved from
http://search.proquest.com/docview/1095224091?accountid=10825
DEVELOPING A WEB BASED CMS USING PHP 44
Shaw, M. (2012). The role of design spaces. IEEE Software, 29(1), 46-50. doi:
http://dx.doi.org/10.1109/MS.2011.121
Sourceforge.net.(2012, September). Retrieved from: http://sourceforge.net/about
Wayner, P. (2012). Review: 2 PHP tools rise above the rest. InfoWorld.Com, Retrieved
from http://search.proquest.com/docview/931169920?accountid=10825
Welling, L. & Thomson L. (2009). PHP and MySQL web development. Fourth edition.
Developer’s Library.
Zeev, S. (2002, June). The next HTML. Computer Technology
Review, 22(6), 38. Retrieved August 15, 2012, from ABI/INFORM Global.
(Document ID: 140669711).
DEVELOPING A WEB BASED CMS USING PHP 45
APPENDICES
APPENDIX A: ADDITIONAL PHP CODE EXAMPLES
Figure 15: index.php
Index.php is the default page that a web server directs a user to when the request a domain.
DEVELOPING A WEB BASED CMS USING PHP 46
Figure 16: header.php
The index.php was broken into sever sections using the include_once command see Figure 15 to
understand how this Figure is stitched into the main index page.
DEVELOPING A WEB BASED CMS USING PHP 47
Figure 17: aside.php
The index.php was broken into sever sections using the include_once command see Figure 15 to
understand how this Figure is stitched into the main index page.
DEVELOPING A WEB BASED CMS USING PHP 48
Figure 18: content.php
The index.php was broken into sever sections using the include_once command see Figure 15 to
understand how this Figure is stitched into the main index page.
DEVELOPING A WEB BASED CMS USING PHP 49
Figure 19: footer.php
The index.php was broken into sever sections using the include_once command see Figure 15 to
understand how this Figure is stitched into the main index page.
DEVELOPING A WEB BASED CMS USING PHP 50
Figure 20: valid_data_fns.php
A simple function to validate the information placed in HTML forms using regular expressions.
Figure 21: require_fns.php
Additional functions can be lumped together in a single file when they are all called repeatedly for the same
actions.
DEVELOPING A WEB BASED CMS USING PHP 51
Figure 22: database_fns.php
This displays the original way to connect to a database using PHP.
DEVELOPING A WEB BASED CMS USING PHP 52
Figure 23: auth_user_fns.php
A check to make sure there is only one match for the user with the correct password in the database before
authorizing the user in the session and sending themto the indexpage.
DEVELOPING A WEB BASED CMS USING PHP 53
APPENDIX B: CMS DIRECTORY HEIRARCHY
Figure 24: directory hierarchy
DEVELOPING A WEB BASED CMS USING PHP 54
APPENDIX C: MYSQL CREATE DATABASE AND USER INFORMATION
TABLES SCRIPT
Figures in appendix C are used for creating the database and adding the user fields only.
Figure 25: create database script
DEVELOPING A WEB BASED CMS USING PHP 55
DEVELOPING A WEB BASED CMS USING PHP 56
DEVELOPING A WEB BASED CMS USING PHP 57
APPENDIX D: MYSQL ENTITY RELATIONAL DIAGRAM
The below figure is a visual representation of appendix C from a relational context.
Figure 26: user database ERD diagram
DEVELOPING A WEB BASED CMS USING PHP 58
APPENDIX F: CSS SCRIPT
Figure 27: CSS script
DEVELOPING A WEB BASED CMS USING PHP 59
DEVELOPING A WEB BASED CMS USING PHP 60
DEVELOPING A WEB BASED CMS USING PHP 61
DEVELOPING A WEB BASED CMS USING PHP 62
DEVELOPING A WEB BASED CMS USING PHP 63
DEVELOPING A WEB BASED CMS USING PHP 64
DEVELOPING A WEB BASED CMS USING PHP 65
DEVELOPING A WEB BASED CMS USING PHP 66
DEVELOPING A WEB BASED CMS USING PHP 67
CURRICULUM VITAE
Bachelors of Science in Information Systems Management, Ferris State University, 2009
Associates in Application Programming, Muskegon Community College, 2006
Associates in Computer Networking, Muskegon Community College, 2005

More Related Content

Similar to Developing an open source content managment system (20)

PDF
Why Should You Choose Webflow For Website Development?
Lucy Zeniffer
 
ODP
Open Source Content Management Systems for Small and Medium Businesses, Chari...
Will Hall
 
PDF
The Significance of CMS Website Development.pdf
engineermaste solution
 
PDF
industrial_placement_report
Omer Abdelatif Mohamed Nour
 
PDF
Headless CMS VS Traditional CMS.pdf
GlanceSys Information Technology Pvt. Ltd.
 
PPTX
Tech Stack & Web App Development For Startups
ZimbleCode
 
PPT
Hci 590 Content Management Systems Week1 090330
bhenkel
 
PPT
Content Management Systems
sahig123
 
PPT
Content Management Systems
sahig123
 
PPT
Cms pres
Mario Noble
 
PDF
B s t profile
Ocean Websoft Pvt. Ltd.
 
PDF
CMS Web Development guidance: Expert Insights & Best Practices for Building P...
infydots technologies
 
DOCX
College Web Site HTML PROJECT
Rai Saheb Bhanwar Singh College Nasrullaganj
 
PDF
The CMO Guide to Headless CMS for B2B SaaS & Tech Companies.pdf
Contento
 
PPTX
Meetup which approach to choose?
Joe Mbaya
 
PDF
CakePHP Development
iSyncEvolutionLLP
 
PPT
Silicon Halton Meetup #44 - Special Presentation By The Weather Network
Silicon Halton
 
PPSX
Cms by ethical_web_solutions
nishant987
 
PPSX
CMS By Ethical Web Solutions
nishant987
 
PPTX
5 reasons to invest in custom website development
Omega_UAE
 
Why Should You Choose Webflow For Website Development?
Lucy Zeniffer
 
Open Source Content Management Systems for Small and Medium Businesses, Chari...
Will Hall
 
The Significance of CMS Website Development.pdf
engineermaste solution
 
industrial_placement_report
Omer Abdelatif Mohamed Nour
 
Headless CMS VS Traditional CMS.pdf
GlanceSys Information Technology Pvt. Ltd.
 
Tech Stack & Web App Development For Startups
ZimbleCode
 
Hci 590 Content Management Systems Week1 090330
bhenkel
 
Content Management Systems
sahig123
 
Content Management Systems
sahig123
 
Cms pres
Mario Noble
 
CMS Web Development guidance: Expert Insights & Best Practices for Building P...
infydots technologies
 
College Web Site HTML PROJECT
Rai Saheb Bhanwar Singh College Nasrullaganj
 
The CMO Guide to Headless CMS for B2B SaaS & Tech Companies.pdf
Contento
 
Meetup which approach to choose?
Joe Mbaya
 
CakePHP Development
iSyncEvolutionLLP
 
Silicon Halton Meetup #44 - Special Presentation By The Weather Network
Silicon Halton
 
Cms by ethical_web_solutions
nishant987
 
CMS By Ethical Web Solutions
nishant987
 
5 reasons to invest in custom website development
Omega_UAE
 

Developing an open source content managment system

  • 1. Running Header: DEVELOPING A WEB BASED CMS USING PHP Developing a Web Based Content Management System Using PHP By: Adam M. Erickson Requirement for Degree: Masters of Science in Information Systems Management Ferris State University, 2012 Advisor: Dr .Douglas L. Blakemore Full Professor Accounting, Finance, and Information Systems Department Fall Semester 2012 Ferris State University Big Rapids, MI
  • 2. DEVELOPING A WEB BASED CMS USING PHP 2 Copyright: 2012, Adam M. Erickson All Rights Reserved
  • 3. DEVELOPING A WEB BASED CMS USING PHP 3 DEDICATION I dedicate this to my wonderful family. Particularly to my children, Scarlett, Charity, Azreal, and Micah, for they have brought fulfillment to my life. I must also dedicate this to my parents, who have helped me along the way and have given me their full support. Finally, I dedicate this work the late ones I love that have passed away, they have helped guide my actions through life by there leadership, faith, and kindness.
  • 4. DEVELOPING A WEB BASED CMS USING PHP 4 ACKNOWLEDGEMENTS I would like to thank all of those people who helped make this thesis possible. I wish to thank my advisors Professor Dr. Barbara Ciaramitaro, Professor Gerald Emerick, and Professor Dr. Doug Blakemore for all their guidance, encouragement, support, and patience. There sincere interests in information systems management and my education have been a great inspiration to me.
  • 5. DEVELOPING A WEB BASED CMS USING PHP 5 TABLE OF CONTENTS Page LIST OF TABLES.......................................................................................................................................................6 LIST OF FIGURES .....................................................................................................................................................7 ABSTRACT .................................................................................................................................................................8 CHAPTER 1 INTRODUCTION ..............................................................................................................................9 CHAPTER 2 BACKGROUND AND LITERATURE REVIEW ....................................................................13 CHAPTER 3 RESEARCH MATERIALS AND METHODS...........................................................................18 CHAPTER 4 DETAILS OF RESEARCH ............................................................................................................22 CHAPTER 5...............................................................................................................................................................38 REFERENCES...........................................................................................................................................................42 APPENDICES............................................................................................................................................................45 CURRICULUM VITAE...........................................................................................................................................67
  • 6. DEVELOPING A WEB BASED CMS USING PHP 6 LIST OF TABLES Page Table 1: Search strings used........................................................................................... 19 Table 2: Requirements ................................................................................................... 20 Table 3: Main Folders in Directory ............................................................................... 29
  • 7. DEVELOPING A WEB BASED CMS USING PHP 7 LIST OF FIGURES Page Image 1: MySQL Command Line Client.......................................................................... 24 Image 2: phpMyAdmin..................................................................................................... 25 Image 3: WampServer options.......................................................................................... 26 Image 4: Eclipse for PHP Developers .............................................................................. 27 Figure 5: MVC .................................................................................................................. 30 Figure 6: User Table ......................................................................................................... 31 Figure 7: CSS ID Tags...................................................................................................... 33 Figure 8: CSS link............................................................................................................. 33 Figure 9 index.php ............................................................................................................ 34 Figure 10: PHP Login Form ............................................................................................. 35 Figure 11: HTML Login Form ......................................................................................... 35 Figure 12: PHP to Check for SQL injection ..................................................................... 36 Figure 13: PHP to Check if User Exist ............................................................................ 37 Figure 14: Final Front End Look ...................................................................................... 39
  • 8. DEVELOPING A WEB BASED CMS USING PHP 8 ABSTRACT The Content Management System (CMS) is a web based application using a Linux Server, Apache Web-server, MySQL Database, and PHP Programming Language (LAMP). It is intended for managing user, and information in any given web environment that is only hindered by imagination. The main objective of this application is to begin the initial development of a CMS by creating the building blocks for developing and taking into consideration basic methods for creating the base platform of a CMS for further development. All information gathered, and experience gained will help with developing and offering my own personal e-commerce business solutions in the future and gain further business and technical understanding for future employment and dissertations in free open source software and e-commerce.
  • 9. DEVELOPING A WEB BASED CMS USING PHP 9 CHAPTER 1 INTRODUCTION Working with several different Content Management Systems (CMS) to adapt to one specific CMS within Open Source Software (OSS) like Joomla, Xoops, Wordpress, Drupal, Zend Cart, OS-Commerce, and/or any other web-based CMS can be stressful. Trying to create an acceptable theme and/or manage plug-ins so each CMS works the way they are needed and not the way the developers initially intended for a company requesting it, or for personal use, can result in an unfruitful endeavor into application development. When you are adapting to some other developers intended business model, it never seems to have the exact requirements that a company is looking for. Given that there is a proper amount of time, it would be much easier to create a core CMS from scratch. This would allow for a company to design and develop a solution that would offer exactly what an organization requires. Regardless if it is for a simple business report or if it is used for an Intranet or intranet site, if the solution is allowing for specific customizable functional and aesthetic designs during development of a websites that is best suited for any organizations’ web based needs, it will have a significant better chance of being adopted. 1.1 BACKGROUND OF THE PROBLEM
  • 10. DEVELOPING A WEB BASED CMS USING PHP 10 Applications for CMS’s have been developed within a number of commercial and free software communities that are available to users is ever increasing because of the availability of newer technology, and the increasing demands of what user requests. The basic approach, in project management terms, is that what a user wants is a great product, that is cheap, and they want it yesterday. Developing a web site can take a few months to a few years when you have to factor in design, aesthetics, and functionality. While it can take a lot of man hours to complete, there should be little to no overhead in software costs to users because licensing costs after initial development should be of little concern. By designing a system from scratch, an organization has the ability to utilize all the latest and greatest technology that is available and mold the system to fit their company’s requirements. 1.2 STATEMENT OF THE PROBLEM Therefore, the problem addressed in this study is the ability to create a CMS from the core requirements for organizations using all OSS technology with an emphasis on being open object oriented within a Model View Control/agile framework, to deliver a web based application that will meet the needs of a company and be easily to modify in the future. 1.3 OBJECTIVES OF THE STUDY The objective of this exercise is to finish the beginning stages of development and start the initial programming on a core, PHP driven, website that will allow for additional plug-ins. Because there will be a better understanding of the underlying foundation that is being used, any modifications, wither functional or aesthetic, designing will be easier to
  • 11. DEVELOPING A WEB BASED CMS USING PHP 11 comprehend. Additionally, the final completed core CMS may be used for educational purposes. 1.4 RATIONALE FOR THE STUDY By researching design a core CMS using current application design methodology using a Linux, Apache, MySQL, and PHP, for an HTML, JavaScript frontend in order to better define current best practices used for content management systems. 1.5 NATURE OF THE STUDY The nature of this study will be comparative analyses of best practices in web development when building the core system of a content management system, and project to define and design a core content management system using PHP, JavaScript, HTML, and MySQL on Apache, using a Linux server. 1.6 DEFINITION OF TERMS CSS - Cascading Style Sheets helps format the look and feel of an HTML document through presentation semantics. CMS - Content Management System is a computer program that allows publishing, editing and modifying content within the application. CRUD - Create, Reuse, Update, Delete are the four basic functions of a persistent storage application. HTML - Hypertext Markup Language, the main language for displaying web content in a web browser. IDE - Integrated Development Environment, a program to facilitate the complexities of developing large programs.
  • 12. DEVELOPING A WEB BASED CMS USING PHP 12 ISS - Internet Information Server is the web server that comes pre-packaged within windows servers. JavaScript - A scripting language that is usually implemented within a web page to add more functionality and user enhancements. LAMP - A term used for the platform of servers that host a web application a LAMP stack consists of a Linux, Apache, MySQL, and PHP server. MVC - Model View Control, is an architecture model for separating different interactions within a program. OOP - Object Oriented Programming, using class object to pull instances of a section of code when necessary using techniques like inheritance to separate classes logically. PHP - Hypertext Preprocessor, a server side embedded scripting language. WAMP - A term used for the platform of servers that host a web application a WAMP stack consists of a Windows Apache, MySQL, and PHP server. XML - Extensible Makeup Language is a markup language that helps define the rules for encoding documents. 1.6 ASSUMPTIONS AND LIMITATIONS While most people prefer to save money, there is sometime a need for speed or the inability to give time to web developer finance a truly free solution that fits business needs. There is several information that can be gleamed from the web on how to develop the web but not so much in academia and public libraries that is up to date and available.
  • 13. DEVELOPING A WEB BASED CMS USING PHP 13 CHAPTER 2 BACKGROUND AND LITERATURE REVIEW The Internet is constantly evolving since its humble beginnings as ARPAnet, a government funded communications network, back in 1969 (McKenzie, 2011) with additional help from researchers, academics, and companies like AT&T (Crovitz, 2012). In the beginning it was just a textual messaging system and requirements grew with demand to be able to markup the language with formatting to make it easier to read and visually appealing with the aid of Hypertext Markup Language (HTML). The Internet evolved with a need for more interaction from users in a graphical user environment. Web pages could not be static anymore as business pushed for the ability to do more than provide information and actually be able to offer online sales and services with interactive pages using methods like JavaScript, Adobe Flash and/or Dynamic-HTML. A most significant change in how we use the Internet was the introduction of server-side scripting languages. Server-side scripting languages gave developers the ability to take dynamic web pages and create transactional-oriented web pages. Server-side scripting languages that have been widely used in production have included Oracle’s Java Server Pages (JSP), open source Perl, Microsoft’s Active Server Pages (ASP), and the open source Hypertext Preprocessor (PHP), (Suraski, 2002). These scripting languages allow
  • 14. DEVELOPING A WEB BASED CMS USING PHP 14 access to data bases, and opened the way for how we use the Internet today with electronic commerce (e-commerce). The popularity of Open Source Software (OSS) when developing web pages has continued to grow. The real hold out on why more professional do not implement OSS is because of it not being as mature as some proprietary software and it lacks the marketing initiative that proprietary providers have invested in (Gittens, 2007). 2.1 OPEN SOURCE SOFTWARE OSS is a set of practices used to collaborate with software source code that has been made freely available through copywriting laws. OSS can come from individuals separated by diverse cultural, corporate boundaries, language and other characteristics in order to work together to create complex, non-proprietary software. Software is open sourced when it is free to redistribute, the source code is redistributed with it as well as in compiled mode. The open source licensing was created to make the source code of a program readily available to anyone that requests it. OSS protects the original author of the software, does not discriminate in anyway on how it can be used, cannot be specific to a product or software, cannot restrict other software and has to be technology neutral (open source, n.d.). Open Source Software (OSS), is the most viable solution for creating a CMS because of its popularity, performance, and cost effectiveness. As of September 2012, Sourceforge.net’s website proudly boasts numbers of 3.4 million open source developers working on over 324,000 OSS projects with an average of 4 million OSS downloads per day. Most popular OSS software that can be easily obtained and utilized on the Internet
  • 15. DEVELOPING A WEB BASED CMS USING PHP 15 is the Linux OS (Operating System), Apache Web Server, MySQL Database, and the Hypertext Preprocessing Language (PHP). There are several other applications that can be used to develop websites but the grouping listed has grown in popularity to have there own acronym LAMP and is covered on almost all popular web hosting sites while other open source software like Java and the Tomcat Java Server are rarer and usually cost a significant amount more to run a web based platform from. Some of the more widely known open source licenses cover the GNU(Graphical Environment of Linux Servers and Desktops), Mozilla (Firefox, Thunderbird), MIT, BSD (like Unix), and Eclipse (Eclipse IDE). Because of the lack of dependency on software vendors, open source software allows the software to transform and morph into potentially anything the users and developers need the software to do. 2.3 APACHE WEB SERVER Apache the HTTP web server is continuing to be one of the most popular web servers for hosting web content. Wither it is in commercial or open source terms (Open platforms, 2012). Apache Web Server is the 1995 collaborative project that offers the source code for free to the HTTP Web server (Apache, n.d.). 2.4 MYSQL DATABASE MySQL is the world’s most popular database and is powering some of the largest companies online, including Facebook, Google, Amazon, and Yahoo (Henschen, 2011). Its impressive combination of fast SQL queries with access to the source code for free has made it another success like Apache and PHP with over sixty five thousand downloads per day (Mysql, n.d.).
  • 16. DEVELOPING A WEB BASED CMS USING PHP 16 2.5 PHP: HYPERTEXT PREPROCESSOR The hypertext preprocessing language (PHP) is an open sourced product that lacks the marketing power from companies like Adobe Flash and Oracle’s Java. It is a server-side multi-platform, scripting language that can be embedded within HTML. Unlike JSP (java server pages), and ASP (active server pages), PHP has its own language and is strongly acknowledged with Apache but can work with other Web servers (Kevin, 2002). Thanks to companies like Red Hat and Zend, the popularity of PHP is increasing as they offer built in platforms that offer support for PHP developers (Red hat, 2012). Some of PHP’s strengths are that it is very fast and can serve millions of hits per day. PHP is free so that it can inexpensively be deployed in horizontal scaling in a large number of servers. PHP can be integrated with many database systems within the PHP libraries, there is also built in libraries for common Internet tasks like parsing XML, sending email, working with cookies, generating PDF documents, and all with just a small amount of additional code. Other reasons that PHP is growing in popularity is its portability between systems, the flexibility of development approaches, the similarities between Java and C programming, and availability of supporting documentation and support (Welling & Thomson L, 2009). 2.6 INTEGRATED DEVELOPMENT ENVIRONMENT For every programming language out, eventually an IDE (integrated development platform) is released to help structure and order the code blocks for any given complex application. Several commercially paid and free versions exist for PHP that can be either downloaded for free or purchased. A couple of the most popular IDE’s are Zend Studio’s
  • 17. DEVELOPING A WEB BASED CMS USING PHP 17 Eclipse version and PhpStorm. Zend Studio is from the creators of PHP and best for developers who are already familiar with Eclipse or IBM’s commercial version Rational (Wayner, 2012). 2.7 MODEL VIEW CONTROL In the classic MVC (model, view, control) methodology, the controller is basically the mediator between the user’s actions through the view of the user interface. In the case of web development, this would be the web browser, and the domain logic, calls to the database, is captured in the model (Shaw, 2012). MVC methodology is already being used in some of the competing software for PHP’s like ASP. Where Microsoft has already incorporated the MVC into one of there platforms called ASP.Net MVC 4 (Krill, 2012).
  • 18. DEVELOPING A WEB BASED CMS USING PHP 18 CHAPTER 3 RESEARCH MATERIALS AND METHODS The project is to implement a core content management system using PHP, HTML, and JavaScript-languages with MySQL database, Linux CentOS and Apache servers. It will be used as launching ground to discover today’s best practices in web development and security when developing an interactive website. My research questions will be answered through the implementation of the project model. 3.1 RESEARCH QUESTION How to build a core CMS with best practices implemented using PHP, MySQL and HTML? 3.2 METHODOLOGY Methodology to answer the research question will be using qualitative analysis and synthesis of other people’s research to discover information useful to implement a project model that will be utilized to analyze my project as part of the project. In order to answer my stated research question I will be conducting a comprehensive search for relevant studies and literature reviews found in different stages and using the following sources: − Google Scholar − Google − ABI/IFORM Global − Current books available in web development, PHP, and CMS
  • 19. DEVELOPING A WEB BASED CMS USING PHP 19 Collected information on studies that examine the research question will be analyzed for data from acceptable studies and decisions. A report will be provided highlighting implications and alternative solutions when available. Popular CMS sites (Wordpress, Drupal and Joomla) will be analyzed to determine design factors like the directory structure on the server and development of SQL tables. Research will include search strings like “PHP web development evaluation”, “PHP MVC templating”, and “comparison of PHP4 and PHP5”. There were several other results that were found but few that were relevant because they were to general or did not cover the stated research question. Common used search strings can be found in Table 1. Search Strings Used PHP5 web development Comparison of PHP4 and PHP5 PHP MVC web development PHP CMS web development Web development best practices PHP best practices PHP framework evaluation CMS best practices MySQL and PHP Table 1: Search strings used In order to implement a solution for creating the content management system using popular and available technology, common development solutions will be evaluated and compared against other development resources. All development coding and resources must be able to work within the testing environment.
  • 20. DEVELOPING A WEB BASED CMS USING PHP 20 Once completed, checks will be made to make sure that it can be implemented on a LAMP web hosting platform, and security measures are in place. Below in Table 2 is a list of the server information requirements that will be used as a testing environment for my research. System Requirements Name/Version Comments Linux x86 CentOS 5.5 Sever Apache 2.2.21 Web server JavaScript Validation PHP 5.3.10 Coding MySQL 5.1.52 Database Table 2: Requirements Model View Control methodology will be a part of the process and will prove that PHP can be used for the modeling and the viewing without the need of a templating engine. The stable release of PHP is an acceptable practice with several of the security options that were not covered in previous releases. The release of PHP5 has many security and development improvements that will be utilized within the CMS development stages. Comparison on programming and security will be taken from the developer’s website along with publications and well established developing websites within the web development community. To define what applications should be used for developing websites with PHP, I will be comparing and contrasting the most commonly used methods. Conclusion based on my own experience and what is available through online discussions will allow me to come to my own conclusions.
  • 21. DEVELOPING A WEB BASED CMS USING PHP 21 3.3 MILESTONES 1. Determining what software, by criteria, can be leveraged to develop a PHP website 2. Directory Structuring on the server for security and manageability of code 3. Determining if there is a need to use a templating engine 4. Example SQL syntax 5. A HTML5 structuring with CSS3 template for a welcome page 6. Example PHP coding for user management
  • 22. DEVELOPING A WEB BASED CMS USING PHP 22 CHAPTER 4 DETAILS OF RESEARCH 4.1 INTRODUCTION Running through several sites and books it took several attempts and failures to select the correct methods of creating a simple content management site that uses PHP5, CSS, and HTML. Several options are available for creating a site and the hardest steps to decide are the beginning ones. Having the correct PHP, web-server, and database settings took the longest time. Afterwards weeks were spent deciding on how to structure the web directory and creating the user login requirements for the actual site. 4.2 APPLICATIONS The main constraint for development of my CMS is cost, every tool that is available, I want available to anyone with access to a computer and the Internet to be able to duplicate my choices. The second constraint is popularity because the more popular the tool, the more options, references, and communities on the Internet are available as well as webhosting sites that offer the same solutions I propose. The reasoning for keeping things free is to promote others to develop on the same framework in order to educate and help create future developers who may not believe they have the tools on hand because some of the other most talked about frameworks take a lot of money or education to
  • 23. DEVELOPING A WEB BASED CMS USING PHP 23 begin developing within. One of the most expensive IDE’s would be for Microsoft C# and even less expensive programming languages like Java still require a considerable more amount of education and web-hosting costs for a Tomcat web-server to be available. Most web hosting companies offer a LAMP stack for development web pages and some of the most popular content management systems like Joomla, Drupal, and Wordpress also use the LAMP stack because it is FOSS (free open source software). This is the reasoning that I have chosen to develop my CMS. To develop around software that is easily accessible, free to use and distribute, with a large community base online for referencing and help. In order to develop a PHP system you have to have the services present to work with PHP. The PHP server can be installed on Apache or IIS (Internet Information Server) Web Servers, it was created to run strictly with Apache and when used in conjunction with IIS has been known to created problems and further editing of configuration files are necessary for it to work correctly with IIS. Once a web-server is installed there is also a need to create dynamic page content, based on users that come to your site. In order to track and monitor users, and modify page content based on what a user wants, it is necessary to have some sort of way to easily and quickly save and access information. This is where SQL (Structured Query Language) databases come in, because of the amount of information that can be quickly accessed as a system grows by a SQL server. Data is more easily to structure and also to secure with SQL. Just about any database can be accessed and modified through PHP including MS-SQL, Oracle, and
  • 24. DEVELOPING A WEB BASED CMS USING PHP 24 DB2. MySQL (www.mysql.com) is judged to be the most popular to use because it is free to use and download, it is one of the very few databases that are offered by webhosting companies for no additional charge, and there is a free web based graphic environment plug-in to modify the MySQL database. With out a web GUI (graphical user interface) user are constrained to only the default command line tool for MySQL pictured below in Image 1. Image 1: MySQL Command Line Client PhpMyAdmin (http://www.phpmyadmin.net) is a free tool written in PHP that helps handle administration of a MySQL server by offering support through a wide range of operating inside a MySQL server. SQL operations that can be used through he user interface can help in managing databases, tables, fields, relations, indexes, user permissions and even execute directly to the MySQL server SQL syntax statements. The below Image 2 displays a few options of how phpMyAdmin is viewed compared to the command line tool offered with MySQL.
  • 25. DEVELOPING A WEB BASED CMS USING PHP 25 Image 2: phpMyAdmin Because I do not want my trial and errors seen by anyone on the Internet I have postponed moving my development to the Internet until next year. If all things go well I will move all my Wordpress documents to my own personally built CMS. Until then I need to have a system available to mirror the options that I would have with a web hosting site like Hostgator.com and GoDaddy.com. This means selecting software that can run on my computer. A WAMP (Windows, Apache, MySQL, and PHP) server that could run on a Windows 7 platform and give me all the options that I would expect from an LAMP web-serving host would need to be chosen. Two of the most popular software that is available for free downloads are XAMPP, and WampServer. XAMPP for windows offers several options including an FTP server, Tomcat server for Java, and Perl. WampServer offers just the basic functions I was looking for; an updated version of PHP, Apache and MySQL. XAMMP was not as easy to configure as it wanted to install
  • 26. DEVELOPING A WEB BASED CMS USING PHP 26 Apache and MySQL as services on the computer which was very volatile because of the security settings in Windows 7. The configurable settings seen below in Image 3 for WampServer worked flawlessly and were very simple to configure. A version to download can be found at this link: http://www.wampserver.com/en/. Image 3: WampServer options With financial limitations of several potential developers in the world including this author, I have chosen to go with a free Integrated Developing Environment Platform (IDE) because developing a system as extensive as a CMS, would be very complicated to develop using only text files, an IDE can be very useful. One of the most popular IDE’s that is also extensively used for Android development, Java, XML, and PHP is Eclipse. Eclipse, shown below in Image 4, is the free version of IBM’s Rational IDE that was released to the public as open source software to further promote the development of Rational. In the several years since Eclipse’s release there have been several different versions released. With the right plug-ins, it allows users to see syntax highlighting, can
  • 27. DEVELOPING A WEB BASED CMS USING PHP 27 help with code completion, navigation, errors and warning highlighting, debugging, refactoring and code generation. It is used by individuals and companies world wide. Image 4: Eclipse for PHP Developers The other popular IDE for PHP development is NetBeans by Oracle. NetBeans and Eclipse are both downloadable for free but Eclipse is what I have been training on for years. In the end it is mostly a decision that is made personally. Both products offer the same functionality. Zend (www.zend.com) offers the free download for Eclipse with PHP debugging. NetBeans can be downloaded for free at: www.netbeans.org.
  • 28. DEVELOPING A WEB BASED CMS USING PHP 28 4.3 FOLDER HIERARCHY Once software is determined it is still not time to start programming yet. As a CMS grows, so does the amount of data that will be managed. Having a simple way to manage all the different types of files is important. Building a directory structure that makes browsing and storing information easier for the developer is very helpful. In order to determine how information will be partitioned into a directory structure can also help to create security checks on objects that are created in a CMS. Knowing that everything that an administrator can do is all located within an administrator file makes it less of a hassle to determine what should be seen and what should not. It also allows determining what rights certain files should be had, if they should be read, write or execute only. For a designer on a CMS project it helps determine what files should be worked on from ones that should be left alone. A directory structure can be very subjective but should make sense to everyone that will be using it, the programmers, and designers. In the below table, is the basic folders that have been designated for use building the CMS. While not all are used at the moment is a good practice to expect growth in are programming in the future and to make room for it. Table 3 below illustrates the folders with the logical reasoning for choosing these folders. Folder Name Folder definition/Reasoning admin The place to configure all website maintenance cache Used to store previously used views so that PHP does not have to build the code from scratch again and database queries. classes When implementing personalclasses for OOP, this is internal classes would be stored. components Major extension, a complex display that can be broken up into less complex components.This is how MVC can be broken up.
  • 29. DEVELOPING A WEB BASED CMS USING PHP 29 configs Stores additional configuration settings editor Can be used to store an external WYSIWYG editor. extClasses Classes created by others that may be added to the CMS. help A place to save all help files. Proper documentation here can help a lot in the future. images A place to store uploaded images. includes Functions and otherfiles that handle the arrangement and management of data besides the classes and components. media Like the editor folder, media is for editing and management media. modules Minor extensions that create small screen boxes with useful information like who is online but not necessary like components. params Static parameters for some functions and classes can be stored here for easy access. templates Besides for the admin templates this folder will hold all the othertemplates for changing the look of the CMS through HTML, JavaScript, and CSS Table 3: Main Folders in Directory Folders below the main folder are created to help differentiate certain sections from other. One example is the admin folder. The admin folder maintains its own modules, components, help files, media, editor, and template files to make it easier for a programmer to differentiate between user access and admin access areas. Within components there is a separate folder within each component. Under the component for users there are three folders used to create a MVC that will be necessary for separating design, from the data, and the controllers that are called upon the data. A visual representation of the hierarchy in a folder view is located with in appendix B, 4.4 MVC AND TEMPLATING As discussed, because code can start to become very complex as the project grows it becomes more and more important to separate business logic and presentation data separately. The Model will contain the methods used to call on the database and make add, remove update calls to the database. The Controller is responsible in the application of holding all other PHP that does not manipulate data like answering requests from the
  • 30. DEVELOPING A WEB BASED CMS USING PHP 30 user and calling on the model to manipulate the data. The View is the part of the programming that will render the HTML. The View is commands called from the controller that requested methods from the Model are displayed through rendered HTML, JavaScript, CSS and/or images as seen in the below Figure 5. Figure 5: MVC While using a templating engine along side of the View can help in separating display logic and actual business logic, a good PHP programmer should be able to separate the two in separate files without needing a templating engine that would be one more step of coding that would need to be learned in order to develop the CMS and an additional dependant on the functioning of the CMS if the templating engine stopped being supported. While a templating engine looks good in paper, I have come to the conclusion that it is an unnecessary step in creating a CMS. PHP’s history started out as being a templating engine. I do not see the reasoning for needing to add another processing layer to the PHP code when PHP is still very capable of templating on its own. You just have to make sure that you are upholding to the MVC methodology and keeping any PHP that deals with only viewing information in the Viewing folder of the systems components.
  • 31. DEVELOPING A WEB BASED CMS USING PHP 31 4.5 DATABASE Creation is important to define before encoding, if no done right it can hinder the ability of the programmer to write good code. Take for instance the ability of PHP to take a password form a form and have it transformed into a MD5 128-bit hash value before passing it into the database. A 128-bit hash requires 32 characters in a database field to work, if you did not set up your database to store a 32 character password, it would fail from the beginning. Another to take into consideration is types of data fields that may be created in the near future. While the database can always be changed later, if the fields are already available, it takes away some of the unnecessary time of re-visiting you database to make corrections and fixing additional mistakes you may make when modifying the database. MySQL SQL syntax is very similar to other databases, offering the standard data types to choose from. The below Figure 6, it displays the values set for the user table of my database. Figure 6: User Table
  • 32. DEVELOPING A WEB BASED CMS USING PHP 32 As you can see I did not use a 32 character data set for my password field. I preferred to leave it open to 255 variable character data set, in case I change my mind on how to handle passwords in the future, I will be able to do it without forcing a person into resetting there password the next time they visit the site. Not all fields are being used; the fields that are being used are the id, userName, and password. As the CMS is developed the other fields will be used to better track users by knowing the amounts of times they have tried to log in, to send emails for password reset, see if they are active, promote the user to the admin group, and view additional information on the last actions they had while on the site as well as how long they stayed on the site. 4.6 HTML5 & CSS HTML5 is the new standard for hypertext markup language. It offers the ability to support CSS3 completely and offers new elements and attributes. In order to understand how I have created my index.php, the first page of the site, you need to understand the basics of how HTML can be used. The standard blocks used in most of an HTML5 page in are viewed in the next figure, Figure 7.
  • 33. DEVELOPING A WEB BASED CMS USING PHP 33 Figure 7: CSS ID Tags By using the <div> tag and assigning different id’s to the <div> tags, it allows to structure the theme from a single file in the CSS (content style sheets) that is link to the index page using the below HTML code example displayed in Figure 8. Figure 8: CSS link 4.7 PHP CODE EXAMPLES
  • 34. DEVELOPING A WEB BASED CMS USING PHP 34 It is important to have a general example of how the HTML blocks are located within the CMS so that the way the PHP programming can be better understood. Using the include_once command you can separate logical parts of code and html sections. Figure 9 below, displays how the command is used in the index.php page that is viewed by linking several different pages together from within the CMS directory. Figure 9 index.php
  • 35. DEVELOPING A WEB BASED CMS USING PHP 35 Line 6 in index page above is used to store user information while they are on the CMS. Line 8 checks to see if the user as logged in if they are it prints a welcome message at the top of the screen, and if they are not logged in directs them to the login page. The login page is broken into several different PHP pages. The first page called login.php shown below in Figure 10 contains the form necessary to login. Figure 10: PHP Login Form The PHP has been ended and normal constructs of a simple HTML form shown below in Figure 11 is passed to the browser will the POST function of the HTML from is sent to PHP through session variables to be used against the database for authentication. Figure 11: HTML Login Form
  • 36. DEVELOPING A WEB BASED CMS USING PHP 36 The user enters in their user name and password and select log in, which send the information to auth_user_fns.php script that includes the database_fns.php script used to connect to the database and then scrubs the user name and password fields as a security check so that SQL injection doesn’t occur as seen in the below Figure 12 using the commands stripslashes and mysql_real_escape_string. Figure 12: PHP to Check for SQL injection Next the user name and password are checked against every user name in the database until it finds one match and only one match. Then the PHP code marks the user as a valid user and directs them to the index page where they can begin browse or modify pages based on there rights the coding is shown in the following Figure 13.
  • 37. DEVELOPING A WEB BASED CMS USING PHP 37 Figure 13: PHP to Check if User Exist Additional PHP examples, database entity relation database, CSS sections can be found in the appendices for further information on how I have developed the initial CMS.
  • 38. DEVELOPING A WEB BASED CMS USING PHP 38 CHAPTER 5 SUMMARY While CMS sites are comparatively simple to use once created, I do want to note that initial installation, development, and configuration will be more difficult than just throwing a few PHP, CSS, HTML and JavaScript elements together. Most developers have focused experience on either front-end or back-end development because of all the necessary steps to build a web based information architecture that is secure and free of bugs. Anyone that takes on the action of creating a fully functional CMS would likely want to have an extended network of colleagues to collect best know practices and other additional programming knowledge. Any one who endeavors to create a CMS on the web using a commercial website hosting company should look for a hosting company with interfaces for easy installment and management MySQL and PHP plug-ins. Before PHP and HTML can be fully utilized, there is a learning curve for configuring and setting up Apache, PHP, and MySQL configurations and security. Using PHP you can design a wide range of Internet websites. The developer of an interactive website will have to make many decisions about what functionality and user interfaces to use and allow.
  • 39. DEVELOPING A WEB BASED CMS USING PHP 39 The following Figure 14 displays how my first build of the website will look like from the front end. Figure 14: Final front end view 5.2 CONCLUSION Any web development project does take a high level of experience in many different areas. Building a large scale CMS is like building a house. It would take a very long time and a lot of training for only one person. Most successful large scare web managed systems are developed within teams and other discussion groups and teams. Unlike other programming languages that run through a compiler before being shipped to the client, PHP source code is available for the client to open up and take advantage of a
  • 40. DEVELOPING A WEB BASED CMS USING PHP 40 programmers code to further there own work. This could be looked at as either and advantage for promoting sales or a disadvantage because you can not secure the code after distributing a project to a client. PHP is primarily a web development language with many abilities within the core and additional libraries not covered. Because it is primary a web development tool a good understanding of other technologies like Bash, Cron, Perl, CSS, JavaScript, and HTML are necessary in order to deliver a commercial product. Coming into this project I would define myself and a intermediate web developer, with future study and implementation of different methods of PHP coding, security and functioning sites that offer users different services, I will be able to become and expert in the field. There are several different reasons why I have selected this topic. Future work is to created documentation for publishing that can help to educate students on how to develop interactive web pages that follows object orientated programming (for advance classes) using best known practices in World Wide Web and information architecture. Once the base system is created it can be utilized to create any type of system available in today’s market. Some of the applications can be envision and created can be a document repository system, client management system, online sales management system, a company’s intranet and/or Internet site. 5.3 SUGGESTIONS FOR FURTHER STUDY/WORK Future work that will add functionality to a CMS and also incorporate further study could also include introducing the PEAR library framework of reusable PHP components that offer the ability to for PHP that comes with great functionality for PHP
  • 41. DEVELOPING A WEB BASED CMS USING PHP 41 developers like the ability to authenticate to many different types of operating system authentication servers. This would be very useful because companies ask that any new applications use the same single sign on for security that they are already using. Wither it is works with Active Directory, Radius, LiveUser or OpenID. Additionally the PEAR library offers prepackaged code that will manage XML, caching, event handling, file systems, logging, mail, math, numbers, and other functions that are found in other programming languages like Java yet tailored specifically for web applications and web service like Amazon. Besides just learning about the technology that drives a web page there is also the need to know how to create an aesthetic views, and applications that work the way a client expects. The ability to create information architecture that will be used is imperative. The technology and methods that drive the Internet are numerous and there is always a new way to skin a cat being presented every year it seems. Make sure to stay involved with discussion lists, professional associations, books and journals available online or at the library that deal with application development.
  • 42. DEVELOPING A WEB BASED CMS USING PHP 42 REFERENCES Apache. (n.d.) HTTP Server Project. What is the Apache Server Project Retrieved from: http://httpd.apache.org/ABOUT_APACHE.html Bernstein, M. (2002). 10 tips on writing the living Web. A list apart: For people who make websites, 149. Retrieved from http://www.alistapart.com/articles/writeliving Bonaccorsi, A., & Rossi, C. (2003). Why open source software can succeed. Research Policy, 32(7), 1243-1258. Retrieved October 24, 2011, from ABI/INFORM Global. (Document ID: 405243571). Crovitz, G. (2012, July 30). Information Age: WeHelpedBuildThat.com. Wall Street Journal (Eastern Edition), p. A.11. Retrieved August 15, 2012, from ABI/INFORM Global. (Document ID: 2723545181). Feldman, D. A. (2006, April). Understanding open source: Part 2. KM World, 15(4), 20,22,24. Retrieved October 24, 2011, from ABI/INFORM Global. (Document ID: 1021576011). Gittens, C. (2007, March). Open source is still fighting against fear. Computing Canada, 33(4), 25. Retrieved August 15, 2012, from ABI/INFORM Global. (Document ID: 1252213981).
  • 43. DEVELOPING A WEB BASED CMS USING PHP 43 Henschen, D. (2011). Why all the HADOOPLA? InformationWeek, (1316), 19-20,22- 24,26. Retrieved from http://search.proquest.com/docview/904423979?accountid=10825 Kevin, F. C. (2002). PHP: An open source solution for web programming and dynamic content. Information Technology and Libraries, 21(3), 116-120. Retrieved from http://search.proquest.com/docview/215832480?accountid=10825 Krill, P. (2012). Microsoft upgrades ASP.net MVC to enable faster-loading web apps. InfoWorld.Com, Retrieved from http://search.proquest.com/docview/923642873?accountid=10825 McKenzie, A. (2011). INWG and the Conception of the Internet: An Eyewitness Account. IEEE Annals of the History of Computing, 33(1), 66-71. Retrieved August 15, 2012, from ABI/INFORM Global. (Document ID: 2286554181). MySQL. (n.d.) Market Share. Retrieved from: http://www.mysql.com/why- mysql/marketshare/ Open platforms will win cloud race: Citrix. (2012, Nov 19). The Business Times. Retrieved from http://search.proquest.com/docview/1170523431?accountid=10825 Open Source. (n.d.) The Open Source Definition. Open Source Initiative. Retrieved from http://www.opensource.org/docs/osd Red hat expands OpenShift ecosystem with zend partnership to offer professional-grade environment for PHP developers. (2012, Oct 09). Business Wire. Retrieved from http://search.proquest.com/docview/1095224091?accountid=10825
  • 44. DEVELOPING A WEB BASED CMS USING PHP 44 Shaw, M. (2012). The role of design spaces. IEEE Software, 29(1), 46-50. doi: http://dx.doi.org/10.1109/MS.2011.121 Sourceforge.net.(2012, September). Retrieved from: http://sourceforge.net/about Wayner, P. (2012). Review: 2 PHP tools rise above the rest. InfoWorld.Com, Retrieved from http://search.proquest.com/docview/931169920?accountid=10825 Welling, L. & Thomson L. (2009). PHP and MySQL web development. Fourth edition. Developer’s Library. Zeev, S. (2002, June). The next HTML. Computer Technology Review, 22(6), 38. Retrieved August 15, 2012, from ABI/INFORM Global. (Document ID: 140669711).
  • 45. DEVELOPING A WEB BASED CMS USING PHP 45 APPENDICES APPENDIX A: ADDITIONAL PHP CODE EXAMPLES Figure 15: index.php Index.php is the default page that a web server directs a user to when the request a domain.
  • 46. DEVELOPING A WEB BASED CMS USING PHP 46 Figure 16: header.php The index.php was broken into sever sections using the include_once command see Figure 15 to understand how this Figure is stitched into the main index page.
  • 47. DEVELOPING A WEB BASED CMS USING PHP 47 Figure 17: aside.php The index.php was broken into sever sections using the include_once command see Figure 15 to understand how this Figure is stitched into the main index page.
  • 48. DEVELOPING A WEB BASED CMS USING PHP 48 Figure 18: content.php The index.php was broken into sever sections using the include_once command see Figure 15 to understand how this Figure is stitched into the main index page.
  • 49. DEVELOPING A WEB BASED CMS USING PHP 49 Figure 19: footer.php The index.php was broken into sever sections using the include_once command see Figure 15 to understand how this Figure is stitched into the main index page.
  • 50. DEVELOPING A WEB BASED CMS USING PHP 50 Figure 20: valid_data_fns.php A simple function to validate the information placed in HTML forms using regular expressions. Figure 21: require_fns.php Additional functions can be lumped together in a single file when they are all called repeatedly for the same actions.
  • 51. DEVELOPING A WEB BASED CMS USING PHP 51 Figure 22: database_fns.php This displays the original way to connect to a database using PHP.
  • 52. DEVELOPING A WEB BASED CMS USING PHP 52 Figure 23: auth_user_fns.php A check to make sure there is only one match for the user with the correct password in the database before authorizing the user in the session and sending themto the indexpage.
  • 53. DEVELOPING A WEB BASED CMS USING PHP 53 APPENDIX B: CMS DIRECTORY HEIRARCHY Figure 24: directory hierarchy
  • 54. DEVELOPING A WEB BASED CMS USING PHP 54 APPENDIX C: MYSQL CREATE DATABASE AND USER INFORMATION TABLES SCRIPT Figures in appendix C are used for creating the database and adding the user fields only. Figure 25: create database script
  • 55. DEVELOPING A WEB BASED CMS USING PHP 55
  • 56. DEVELOPING A WEB BASED CMS USING PHP 56
  • 57. DEVELOPING A WEB BASED CMS USING PHP 57 APPENDIX D: MYSQL ENTITY RELATIONAL DIAGRAM The below figure is a visual representation of appendix C from a relational context. Figure 26: user database ERD diagram
  • 58. DEVELOPING A WEB BASED CMS USING PHP 58 APPENDIX F: CSS SCRIPT Figure 27: CSS script
  • 59. DEVELOPING A WEB BASED CMS USING PHP 59
  • 60. DEVELOPING A WEB BASED CMS USING PHP 60
  • 61. DEVELOPING A WEB BASED CMS USING PHP 61
  • 62. DEVELOPING A WEB BASED CMS USING PHP 62
  • 63. DEVELOPING A WEB BASED CMS USING PHP 63
  • 64. DEVELOPING A WEB BASED CMS USING PHP 64
  • 65. DEVELOPING A WEB BASED CMS USING PHP 65
  • 66. DEVELOPING A WEB BASED CMS USING PHP 66
  • 67. DEVELOPING A WEB BASED CMS USING PHP 67 CURRICULUM VITAE Bachelors of Science in Information Systems Management, Ferris State University, 2009 Associates in Application Programming, Muskegon Community College, 2006 Associates in Computer Networking, Muskegon Community College, 2005