MySQL
  Home arrow MySQL arrow Page 2 - Creating the Admin Script for a PHP/MySQL Blogging System
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MYSQL

Creating the Admin Script for a PHP/MySQL Blogging System
By: Jacques Noah
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 23
    2006-10-17


    Table of Contents:
  • Creating the Admin Script for a PHP/MySQL Blogging System
  • The Admin script
  • Functions.php
  • The Links

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Creating the Admin Script for a PHP/MySQL Blogging System - The Admin script
    ( Page 2 of 4 )

    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:

      <?
    if(isset($_GET['action'])){
    $action=$_GET['action'];
    switch($action)
    {
        Case "listusers";
            listusers();
        break;
            Case "listmsgs";
            listmsgs();
            break;
        Case "listcat";
            listcat();
            break;    
        Default;      

            break;
               }
    }else{
     echo '<center><table>
     <tr>
    <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>
            </tr>
                            <tr>
        <td align="center"><font size="" color="">Manage
    Users</font></td>
                </tr>
      </tr>
      <tr>
        <td align="center"><font size="" color="">Manage
    Messages</font></td>
      </tr>';
    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
    User</a>
    <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
     

       

    MYSQL ARTICLES

    - MySQL Security Tips
    - Designing a MySQL Database: Tips and Techniq...
    - The Three Most Important MySQL Queries
    - Null and Empty Strings
    - MySQL Server Tuning Tips and Tricks
    - MySQL Query Optimizations and Schema Design
    - MySQL Benchmarking Tools and Utilities
    - MySQL Benchmarking Concepts and Strategies
    - Take Some Load off MySQL with MemCached
    - MySQL Table Prefix Changer Tool in PHP
    - Using the SIGNAL Statement for Error Handling
    - Error Handling Examples
    - Error Handling
    - Completing a Search Engine with MySQL and PH...
    - Paginating Result Sets for a Search Engine B...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    Stay green...Green IT