PHP Classes

File: sampleProcess.php

Recommend this page to a friend!
  Classes of azizny   Form Maker and Processor   sampleProcess.php   Download  
File: sampleProcess.php
Role: Example script
Content type: text/plain
Description: Form Processor Implementation
Class: Form Maker and Processor
Generate and process contact forms
Author: By
Last change:
Date: 15 years ago
Size: 2,079 bytes
 

Contents

Class file image Download
<?php
/**************************************************/
/*
Released by AwesomePHP.com, under the GPL License, a
copy of it should be attached to the zip file, or
you can view it on http://AwesomePHP.com/gpl.txt
*/
/**************************************************/

/*
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.';}
}
include(
'sampleCreate.php');
?>