Login   Register  
PHP Classes
elePHPant
Icontem

File: PARAMETERS_TEST.PHP.TXT

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Robert Atkinson  >  Parameters  >  PARAMETERS_TEST.PHP.TXT  >  Download  
File: PARAMETERS_TEST.PHP.TXT
Role: Example script
Content type: text/plain
Description: Example Code
Class: Parameters
Validate command line or HTTP request parameters
Author: By
Last change: Change listing priority
Date: 2012-12-07 04:26
Size: 2,736 bytes
 

Contents

Class file image Download
<?php
/*
!------------------------------------------------------------------------------
! AUTHOR: Robert Atkinson - August 2012
! VERSION: 1.0
!------------------------------------------------------------------------------
! RUN FREQUENCY       : As required
! PRERUN REQUISITES   : None
! RERUN PROCEDURE     : 
! SPECIAL NOTE        : 
! PARAMETERS          : 
! USAGE               : PHP PARAMETERS_TEST.PHP targetfile=sys$login:login.com sourcefile=sys$login:login.com
!------------------------------------------------------------------------------
! AMENDMENT LOG:
! Date          Oper        Reason
!------------------------------------------------------------------------------
!
*/


error_reporting(E_ERROR E_WARNING E_PARSE E_ALL);            // Normal level
error_reporting(E_ERROR E_WARNING E_NOTICE E_STRICT E_ALL);    // Programming/debugging level
ini_set("max_execution_time",60000);                    // Override the default to allow files to be processed

require_once('global_functions.php');                    // Call global, including error handler
set_error_handler("ErrorHandler");                    // Use my own error handler so problems are trapped



if (!isset($argv)) echo "<pre style='font-size: 12px;'>\n";



// ****************   Local Variables    *****************


// *******************************************************





// ***************************************************************************************************
//                                         Parameters Class
// ***************************************************************************************************


echo "\n\n****** Testing Parameters Class ****** \n\n";

require_once(
'/php$global_lib/parameters_class.php');
$objParameters = new Parameters();
$objParameters->SetDebug(1);
$objParameters->Initialise();
$objParameters->DefineParams('sourcefile',1,'FILE');
$objParameters->DefineParams('targetfile',1,'FILE');
$objParameters->DefineParams('debug',0,'INT',array(0,1));
//$objParameters->DisplayParamDefinition();
if (!$objParameters->VerifyParams()) die(VMS_EXIT_ERROR);

$sourcefile $objParameters->GetParameter('sourcefile');
$targetfile $objParameters->GetParameter('targetfile');
$debug_level $objParameters->GetParameter('debug');

if (!
file_exists($sourcefile)) {
    echo 
"Cannot process '" $objParameters->GetParameter('sourcefile',"RAW") . "' - file does not exist\n";
    die(
VMS_EXIT_ERROR);
};




// ***************************************************************************************************
// ***************************************************************************************************



if (!isset($argv)) echo '</pre>';



?>