[Free Class] Process any HTML forum

Discussion in 'PHP' started by Barti1987, Sep 19, 2008.

  1. #1
    Here is the PHP Code:

    
    /*
    Sample Implementation of Form Processing
    ----------------------------------------
    */
    
    require('formProcessor.class.php');
    
    /* Create a new processor */
    $doForm = new processForum;
    
    /* Mail the forum to  
     alllowed separators(, :;) can be mixed together
    */
    $doForm->sendMail('support@sonimager.com');
    
    /* Site variables */
    $doForm->setSettings('Site Name','support@sonimager.com');
    
    /////////////////////////////////////////////////////////////
    /* File Uploading, can be ignored if no files are
    uploaded */
    /////////////////////////////////////////////////////////////
    /* Do you want to email files to above emails?
    */
    $doForm->mailFiles(true);
    
    /* Where to store files uploded */
    $doForm->setStorage('../fileStore/');
    
    /* Allowed extensions
     alllowed separators(, :;) can be mixed together
    */
    $doForm->allowedExtensions('jpeg,gif;png:jpg');
    
    /* Max file Size KB */
    $doForm->maxSize(256000);
    /////////////////////////////////////////////////////////////
    /* End file uploading options */
    /////////////////////////////////////////////////////////////
    
    /* Are there any required fields?
       If so, are they username? email? */
    $requirements[] = array('user_name','username');
    $requirements[] = array('friend_email','email');
    $requirements[] = array('comment');
    
    /* Check required fields -  Will return error
    message */
    $message =
    $doForm->requireField($requirements,$_POST);
    
    if($message == NULL){
        /* Process the forum, check for required fields
    */
        $doForm->processForm($_POST);
    
        /* If everything is OK, go ahead and upload
    files */
        $message = $doForm->uploadFiles($_FILES);
        
        /* $message will contain an array with any
    mistakes with uploads
           Check if everything is good: */
        if(!is_array($message)){ $message = 'Everything is good.';}
    } 
    
    PHP:
    I just released this class, I will be adding more options/styles soon.

    Download Class/Implementation

    Peace,
     
    Barti1987, Sep 19, 2008 IP