MySQL
  Home arrow MySQL arrow Page 2 - Creating the Admin Script for a PHP/My...
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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: 4 stars4 stars4 stars4 stars4 stars / 21
    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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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

    Route your faxes to your email inbox. Private, secure fax numbers available from CallWave. Choose your fax number.

    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


       · I hope you found my article educational; I welcome your comments.
       · Superb, clear concise and complete. The downloadable code is excellent as cut and...
     

       

    MYSQL ARTICLES

    - 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...
    - Building a Search Engine with MySQL and PHP 5
    - Using Boolean Operators for Full Text and Bo...
    - PHP, MySQL and the PEAR Database
    - Working with PHP and MySQL
    - Getting PHP to Talk to MySQL
    - Creating an RSS Reader: the Reader
    - MySQL Security Overview
    - Creating the Admin Script for a PHP/MySQL Bl...
    - Creating the Blog Script for a PHP/MySQL Blo...

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway