PHP
  Home arrow PHP arrow Creating an Administration Area for a ...
Dev Shed Forums 
Administration  
AJAX  
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 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
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? 
PHP

Creating an Administration Area for a Simple Threaded Discussion Forum
By: Jacques Noah
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2006-10-23

    Table of Contents:
  • Creating an Administration Area for a Simple Threaded Discussion Forum
  • Code
  • The delall() and deltopic($uid) functions
  • Database connection, bad words

  • 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


    Creating an Administration Area for a Simple Threaded Discussion Forum


    (Page 1 of 4 )

    Discussion forums usually need an administrator to handle various tasks that you wouldn't want just any forum user doing, such as banning other users. This article, the second of two parts, will show you how to set up an administration area for a threaded discussion forum, and some of the functions you might want an administrator to manage.

    Introduction

    Following my previous article titled "Creating a Threaded Discussion Forum," we are going to create the administration side of things. Why do we need a administrator? Well, somebody has to manage the forum, and I guess the administrator drew the short straw. On the plus side the administrator can, among other things, ban a user from the forum, delete user entries and even censor the forum to some extend. We are going to implement the following functions:

    • Remove/add certain (bad) words.
    • Retrieve all topics.
    • Delete all topics.
    • Start a new topic.

    To follow along with this part of the article you will need access to a MySQL database (created in the previous article) and any version of PHP above version 4.

    How the administration area works

    Basically, everything is going to be done on one page, which is the "siadmin.php" page. The navigation bar will be on the left with all its links and the main area will be where the outcome of a function will be displayed. The links will all send an action variable, which will be processed by the "switch" function. The action variable will be in a format like this:

    <a href="<? echo $_SERVER['PHP_SELF'] ?>?
    action=deleteall">Delete ALL Topics</a>

    The "$_SERVER['PHP_SELF']" is part of a global array of variables that is available to every PHP script. The PHP_SELF refers to the page on which the code is written. This ensures that the action variable is sent to the siadmin.php page.

    The value of the action variable will be handled by the switch statement.  The switch statement has the following syntax:

    switch(){
    Case "condition1"
    Statements
    break;
    }

    Because it can handle a lot of different conditions in a clear and precise way, it is ideally suited to process the five links that we have in our navigation section. I use only one page for the administration because otherwise I would have had to create a page for each function. That would have required far more coding and waste valuable processing power on the server.

    More PHP Articles
    More By Jacques Noah


       · This is a very good article, clearly and profesionally written by this wonderful and...
       · Thanks for the encouraging comments!
     

       

    PHP ARTICLES

    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview
    - Handling Attachments in MIME Email with PHP
    - Completing the Project Management Application





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