Home arrow MySQL arrow Page 2 - Creating the Admin Script for a PHP/MySQL Blogging System

The Admin script - MySQL

In this part of the series we will be writing the administration of the blog. The idea is to give the owner of the blog the ability to manage the blog by being able to remove users and articles as required, or to alter the status of users by upgrading them to admin status or banning them. It is also a place where the administrator can start new topics that will then garner their own replies.

  1. Creating the Admin Script for a PHP/MySQL Blogging System
  2. The Admin script
  3. Functions.php
  4. The Links
By: Jacques Noah
Rating: starstarstarstarstar / 33
October 17, 2006

print this article



As stated before, all the work will be done from one page, which I’ve called main.php. This page can only be accessed from the login page, and then only if you are registered as an admin. You can of course change the point of access to the main blog script if you wish. It is only written in this way because it was more practical from the article's point of view.

The page itself has the following code, in addition to the usual HTML formatting:

    Case "listusers";
        Case "listmsgs";
    Case "listcat";

 echo '<center><table>
<td align="center"> <font size="5" color="#00000">MyBlog Admin
Control Centre</font> <br>
         <font size="4" color="">Click on any of the links on the
left to:</font> 
    <td align="center"><font size="" color="">Manage
    <td align="center"><font size="" color="">Manage
echo '</center></table>';

Basically, an action variable is submitted from within the script by the links and will contain the values specified in the "case" conditions. The values in the links are descriptive of what functions need to be carried out. For example, listmsgs will trigger a call to the listmsgs() function. Here’s what the links section looks like in code:

<a href="<? echo $_SERVER['PHP_SELF'] ?>?action=listmsgs">List
All Messages </a>
<a href="<? echo $_SERVER['PHP_SELF'] ?>?action=listcat">List
Categories </a>
<a href="<? echo $_SERVER['PHP_SELF'] ?>?action=listusers">List
All Users </a>
<a href="../LoginScript/register.php?theadmin=1">Create New
<a href="<? echo $_SERVER['PHP_SELF'] ?>?action=listusers">List
All Users </a>

Below is a screen shot of the main.php page:     


There are a couple of other background pages that help to run the admin for the admin script, some of which I will try to explain:

  • Functions.php – Contains all the functions used in admin.
  • Delete.php – Used to delete articles and their comments.
  • Delete_users.php – Used to delete users.
  • Delete_cat.php - Used to delete categories.
  • Ban.php – Used to ban users.
  • New_post.php -- Used for creating new threads and posts.

>>> More MySQL Articles          >>> More By Jacques Noah

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Oracle Unveils MySQL 5.6
- MySQL Vulnerabilities Threaten Databases
- MySQL Cloud Options Expand with Google Cloud...
- MySQL 5.6 Prepped to Handle Demanding Web Use
- ScaleBase Service Virtualizes MySQL Databases
- Oracle Unveils MySQL Conversion Tools
- Akiban Opens Database Software for MySQL Use...
- Oracle Fixes MySQL Bug
- MySQL Databases Vulnerable to Password Hack
- MySQL: Overview of the ALTER TABLE Statement
- MySQL: How to Use the GRANT Statement
- MySQL: Creating, Listing, and Removing Datab...
- MySQL: Create, Show, and Describe Database T...
- MySQL Data and Table Types
- McAfee Releases Audit Plugin for MySQL Users

Developer Shed Affiliates


Dev Shed Tutorial Topics: