How to Make Admin Panel in Php Step by Step

Making a first admin panel in Php is not that easy anyone can think of it. It has been seen on the market that most of the developers over eager to learn new technology i.e. Php and make some changes in their work so as to increase their experience of working. Well, this book provides basic information about making an admin panel for beginners.

A step by step tutorial on how to create an admin panel in php and my sql. First we will explain what an admin panel is and why you would want one. Then we will go over the files that you need to make your admin panel, After that I will explain how to code each page of the admin panel. Finally I will explain how to use some common functions in php and mysql with a real life example.

How to Connect Admin Panel to Website

You can easily connect the admin panel to the website. if you configure the following steps –

Get Free Source Code

First of all, you need to get an admin panel script for your website. Don’t worry. I have provided free source code to connect it. you can get it through the following links –

Click Here to Get Admin Panel Source Code

Extract Zip File

Now, extract the zip file and paste it into your website folder.

Import SQL Database file

You will get database & table files in the ( config) folder. You can import either a database file or table file in your database according to your requirement.

Configure Database Connection

Open database.php and update the database connection details. This file remains in the ( config) folder.

Log in to Admin Panel

You can log in to the admin panel with the following credentials –

Admi Lodin URL – http://localhost/codingstatus/admin-panel/

 S. N Email  Password
 1 superadmin@gmail.com  admin123
 2 testadmin@gmail.com  admin123
 3 tempadmin@gmail.com  admin123

User Management System with PHP & MySQL

User management is an important part of any web application where users can create their account and manage. The users are allowed to register their account and login to access their account. The users are also managed by administrator to allow certain roles or update users info.

So if you’re looking for solution to build secure user management system then you’re here the right place. In this tutorial, you will learn how to create secure user management system with PHP and MySQL. You would also like to checkout Login and Registration System with PHP & MySQL to implement user login and registration.

We will implement functionality to manage user operations like user registration, user email verification, login, password reset and edit profile. We will also create Admin panel to manage users at admin end to create new user, edit existing users details and delete user.

How to Create an Admin Panel for the Website in PHP

If you are a web developer and working with PHP & MySQL. You must read all the following points to learn a new & standard concept. It will also learn you How to write code in a smart way. So, It will be very helpful to increase your coding skills power.

You have already know how to get a free admin panel source code in the previous step. Here, You will get the complete information about files & setting to create an admin panel in PHP.

Before writing the code, You should create the following folder structure –

admin-panel
   |__assets/
   |    |__css/
   |        |_style.css
   |__config/
   |    |__database.php
   |__contact/
   |    |__contact-details.php
   |    |__contact-email.php
   |    |__contact-us-message.php
   |__partials/
   |    |__header.php
   |    |__sidebar.php
   |__scripts/
   |    |__ajax-script.js
   |    |__backend-script.php
   |    |__dynamic-page.php
   |    |__multilevel-script.php
   |    |__admin-login.php
   |__setting/
   |    |__admin-panel.php
   |    |__color-setting.php
   |__website-admin/
   |    |__admin-profile.php
   |    |__change-password.php
   |__website-content/
   |    |__home-content.php
   |__website-setting
   |    |__theme-setting.php
   |    |__website-menu.php
   |    |__website-setting.php
   |__dashboard.php
   |__home.php
   |__index.php
   |__logout.php

let’s start to configure the following steps –

Create MySQL Database and Table

You must create a MySQL database using the following query –

Database Name – admin_panel

You must also create tables using the following query –

Table Name – admin_profileCREATETABLE `admin_profile` (`id` int(10) UNSIGNEDPRIMARYKEY NOT NULL AUTO_INCREMENT,`full_name` varchar(255) DEFAULTNULL,`email` varchar(255) DEFAULTNULL,`mobile` varchar(255) DEFAULTNULL,`address` varchar(255) DEFAULTNULL,`password` varchar(255) DEFAULTNULL,`status` int(10) DEFAULT 0,`created_at` timestamp(6) DEFAULTNULL,) ENGINE=InnoDB DEFAULTCHARSET=latin1;

This table is created to store color name

Table Name – contactsCREATETABLE `contacts` (`id` int(10) UNSIGNEDPRIMARYKEY NOT NULL AUTO_INCREMENT,`full_name` varchar(255) DEFAULTNULL,`email` varchar(255) DEFAULTNULL,`mobile` varchar(255) DEFAULTNULL,`subject` varchar(255) DEFAULTNULL,`created_at` varchar(255) DEFAULTNULL,) ENGINE=InnoDB DEFAULTCHARSET=latin1;

This table is created to store contact message

Full Name – contact-detailsCREATE TABLE `contact_details` (`id` int(10) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,`email` varchar(255) DEFAULT NULL,`mobile` varchar(255) DEFAULT NULL,`google_map` varchar(255) DEFAULT NULL,`address` varchar(255) DEFAULT NULL,`facebook` varchar(255) DEFAULT NULL,`linkedin` varchar(255) DEFAULT NULL,`twitter` varchar(255) DEFAULT NULL,`google_plus` varchar(255) DEFAULT NULL,`instagram` varchar(255) DEFAULT NULL,) ENGINE=InnoDB DEFAULT CHARSET=latin1;

This table is created to store contact details

Full Name – contact-emailCREATETABLE `contact_email` (`id` int(10) UNSIGNEDPRIMARYKEY NOT NULL AUTO_INCREMENT,`email` varchar(255) DEFAULTNULL) ENGINE=InnoDB DEFAULTCHARSET=latin1;

This  table is created to store contact us an email address

Full Name – home_contactCREATETABLE `home_contact` (`id` int(10) UNSIGNEDPRIMARYKEY NOT NULL AUTO_INCREMENT,`content_section` varchar(255) DEFAULTNULL,`first_title` varchar(255) DEFAULTNULL,`second_title` varchar(255) DEFAULTNULL,`description` varchar(255) DEFAULTNULL,) ENGINE=InnoDB DEFAULTCHARSET=latin1;

This table is created to store static content for the website home page

Full Name – theme_settingCREATETABLE `theme_setting` (`id` int(10) UNSIGNEDPRIMARYKEY NOT NULL AUTO_INCREMENT,`header_background` varchar(255) DEFAULTNULL,`footer_background` varchar(255) DEFAULTNULL,`first_title` varchar(255) DEFAULTNULL,`second_title` varchar(255) DEFAULTNULL,`third_title` varchar(255) DEFAULTNULL,`footer_menu_link` int(10) DEFAULT 0,`header_menu_link` int(10) DEFAULT 0,`paragraphp` varchar(255) DEFAULTNULL,`logo_name` varchar(255) DEFAULTNULL,) ENGINE=InnoDB DEFAULTCHARSET=latin1;

This table is created to store theme color

Table Name – website_settingCREATETABLE `website_setting` (`id` int(10) UNSIGNEDPRIMARYKEY NOT NULL AUTO_INCREMENT,`website_title` varchar(255) DEFAULTNULL,`website_name` varchar(255) DEFAULTNULL,`visible_website_name` varchar(255) DEFAULTNULL,`website_logo` varchar(255) DEFAULTNULL,`website_favicon` varchar(255) DEFAULTNULL,`meta_keyword` varchar(255) DEFAULTNULL,`meta_description` varchar(255) DEFAULTNULL,`google_varification_code` varchar(255) DEFAULTNULL,`google_analytics_code` varchar(255) DEFAULTNULL,`created_at` timestamp(6) DEFAULTNULL,) ENGINE=InnoDB DEFAULTCHARSET=latin1;

This table is created to store the website basics information

Connect PHP Script to MySQL Database

Connect Admin Panel PHP script to MySQL database –

File Name – database.php

Create an Admin login

Configure the following points in index.php to create an admin panel –

  • First of all, start the session
  • Assign session login email to a variable $email_address
  • $email_address is not empty, redirect to the dashboard.php.
  • Include database file database.php & admin login admin-login.php
  • Write the HTML code to create an admin login form.
  • Display login success & fail message.

Create an Admin  Dashboard

Configure the following points in dashboard.php to create an admin dashboard –

  • First of all, start the session
  • Assign session login email to a variable $email_address
  • $email_address is not empty, redirect to the index.php.
  • Get the value of cat & subcat query string value.
  • Include the admin files based on cat & subcat query string value.
  • Write HTML code to create an admin dashboard.

Create Admin Header

Configure the following points in header.php to create an admin header –

  • Write the HTML code to create the Admin Header.
  • Fetch the color value from the database.
  • print it within a CSS style to change the admin theme color.

Create Admin Sidebar

Configure the following points in sidebar.php to create an admin sidebar –

  • Write HTML code to create a sidebar.
  • Create sidebar link URL with a query string parameter  cat & subcat

Create Admin Pages

Create the following admin pages and configure the CRUD operation using ajax & PHP. It will explain in the next step –

  • Contact Detail  – Create it to update website contact detail like email, mobile number, address & social link.
  • Contact Email – Create it to set up an email for the contact us page.
  • Website Setting  – Create it to configure a basic website setting like logo, favicon, website name, website title, meta keyword &  description.
  • Contact Us Message – Create it to display contact us a message.
  • Theme Setting  – Create it to configure basic theme settings like navbar  & text color.
  • Website Menu – Create it to create a multilevel menu for header & footer
  • Home Content  – Create it to update static content on the website home page.
  • Admin Profile – Create it to update existing admin & add a new admin to assign role admin panel
  • Change Password  – Create it to change the admin password.
  • Admin Theme Setting – Create it to set up admin theme settings like text & background color.

Create Ajax Script

To configure the following operation without reading the page, you will have to create ajax script to send a request to backend-script.php file –

  • Open admin pages on click sidebar link with a.content-link
  • Insert form data into the database on submit with form id  #adminForm
  • Update data in a database on submitting with form id #updateForm
  • Delete data from the database on click a link with a class .delete
  • Allow admin to manage data on click link with a class .adminRole

Create a Backend PHP Script

You have to create a backend PHP script in the following files. Each script file has its own functionality to perform.

  • backend-scritp.php – Create it to perform the CRUD operation of admin pages.
  • dynamic-page.php – Create it to include the admin page dynamically.
  • multilevel-script.php – Create it to create a multilevel menu for the header & footer menu.

Conclusion

Making an admin panel is a very important part of any web application, So here we will learn step by step to create one, using best practices.

0 Comments

No Comment.