PHP
  Home arrow PHP arrow Creating an Administration Area for a Simple Threaded Discussion Forum
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? 
Google.com  
PHP

Creating an Administration Area for a Simple Threaded Discussion Forum
By: Jacques Noah
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 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:
      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 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
     

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek