My error: Fatal error: Call to undefined method ModProcess::procBanUser() in /home/dannyf/public_html/secure/mod/modprocess.php on line 26
The modprocess.php code:
<?
/**
* ModProcess.php
*
* The ModProcess class is meant to simplify the task of processing
* admin submitted forms from the admin center, these deal with
* member system adjustments.
*
* Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
* Last Updated: August 15, 2004
*/
include("../include/session.php");
class ModProcess
{
/* Class constructor */
function ModProcess(){
global $session;
/* Make sure administrator is accessing page */
if(!$session->isMod()){
header("Location: ../main.php");
return;
}
/* Admin submitted ban user form */
else if(isset($_POST['subbanuser'])){
$this->procBanUser();
}
/* Should not get here, redirect to home page */
else{
header("Location: ../main.php");
}
}
}
/**
* procBanUser - If the submitted username is correct,
* the user is banned from the member system, which entails
* removing the username from the users table and adding
* it to the banned users table.
*/
function procBanUser(){
global $session, $database, $form;
/* Username error checking */
$subuser = $this->checkUsername("banuser");
/* Errors exist, have user correct them */
if($form->num_errors > 0){
$_SESSION['value_array'] = $_POST;
$_SESSION['error_array'] = $form->getErrorArray();
header("Location: ".$session->referrer);
}
/* Ban user from member system */
else{
$q = "DELETE FROM ".TBL_USERS." WHERE username = '$subuser'";
$database->query($q);
$q = "INSERT INTO ".TBL_BANNED_USERS." VALUES ('$subuser', $session->time)";
$database->query($q);
header("Location: ".$session->referrer);
}
}
/**
* checkUsername - Helper function for the above processing,
* it makes sure the submitted username is valid, if not,
* it adds the appropritate error to the form.
*/
function checkUsername($uname, $ban=false){
global $database, $form;
/* Username error checking */
$subuser = $_POST[$uname];
$field = $uname; //Use field name for username
if(!$subuser || strlen($subuser = trim($subuser)) == 0){
$form->setError($field, "* Username not entered<br>");
}
else{
/* Make sure username is in database */
$subuser = stripslashes($subuser);
if(strlen($subuser) < 5 || strlen($subuser) > 30 ||
!eregi("^([0-9a-z])+$", $subuser) ||
(!$ban && !$database->usernameTaken($subuser))){
$form->setError($field, "* Username does not exist<br>");
}
}
return $subuser;
}
/* Initialize process */
$ModProcess = new ModProcess;
?>