Skip to content

megancoyle/php_cms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP CMS

A custom CMS system created with PHP and MySQL. Admin users have access to CRUD functionality.

Screenshot

The CMS includes authentication where admins have a different view where they can:

  • Manage other admins
  • Edit content
  • Add content
  • Delete content

Screenshot

Technologies Used

  • PHP
  • MySQL

Installation

For setting this up on your local machine to work, you'll need to make sure you have MySQL available. Via the command line, use the following commands:

  1. Login
mysql -u root -p
  1. Create your database
CREATE DATABASE time_management;
  1. Make sure the database was properly created
SHOW DATABASES;
  1. Use the created database
USE time_management
  1. For created user, grant all privileges
GRANT ALL PRIVILEGES ON time_management.*
TO 'time_cms'@'localhost'
IDENTIFIED BY 'secretpassword';
  1. Check privileges
SHOW GRANTS FOR 'time_cms'@'localhost';
  1. Log out of MySQL with exit, then login with new user
mysql -u time_cms -p time_management
  1. Create subject table
CREATE TABLE subjects (
 id INT(11) NOT NULL AUTO_INCREMENT,
 menu_name VARCHAR(30) NOT NULL,
 position INT(3) NOT NULL,
 visible TINYINT(1) NOT NULL,
 PRIMARY KEY (id)
);
  1. Populate table with placeholder data
INSERT INTO subjects (menu_name, position, visible) VALUES ('About', 1, 1);

INSERT INTO subjects (menu_name, position, visible) VALUES ('Products', 2, 1);

INSERT INTO subjects (menu_name, position, visible) VALUES ('Services', 3, 1);

INSERT INTO subjects (menu_name, position, visible) VALUES ('Misc', 4, 0);
  1. Create pages table
CREATE TABLE pages ( id INT(11) NOT NULL AUTO_INCREMENT, subject_id INT(11) NOT NULL, menu_name VARCHAR(30) NOT NULL, position INT(3) NOT NULL, visible TINYINT(1) NOT NULL, content TEXT, PRIMARY KEY (id), INDEX (subject_id) );
  1. Populate pages with placeholder data
INSERT INTO pages (subject_id, menu_name, position, visible, content) VALUES (1, 'Our Mission', 1, 1, 'Our mission has always been...');

INSERT INTO pages (subject_id, menu_name, position, visible, content) VALUES (1, 'Our History', 2, 1, 'Founded a while ago.');

INSERT INTO pages (subject_id, menu_name, position, visible, content) VALUES (2, 'Tools', 1, 1, 'Helpful Tools for your time management.');

INSERT INTO pages (subject_id, menu_name, position, visible, content) VALUES (2, 'Resources', 2, 1, 'Articles to help you with your time management.');

INSERT INTO pages (subject_id, menu_name, position, visible, content) VALUES (3, 'Work Life Balance', 1, 1, 'Finding a work life balance is essential.');

INSERT INTO pages (subject_id, menu_name, position, visible, content) VALUES (3, 'Becoming More Productive', 2, 1, 'Help you find methods to keep you more motivated and productive.');
  1. To view added data
SELECT * FROM pages
  1. Create admin table
CREATE TABLE admins (
 id INT(11) NOT NULL AUTO_INCREMENT,
 username VARCHAR(50) NOT NULL,
 hashed_password VARCHAR(60) NOT NULL,
 PRIMARY KEY (id)
);

Releases

No releases published

Packages