and <== //==> //<== // Open directory that contains the "command" files $CMD_DIR=opendir($COMMAND_DIR); $CL_POS=0; // Holds the index of the next command line option to be used $OPTION=0; // Holds the number of the command to be executed // Read the next command line argument into $OPTION, if it exists if( $argc>=$CL_POS+1 ) $OPTION=$argv[$CL_POS++]; // If $OPTION is not valid, set command to be run to the default command if( (0+$OPTION)<=0 ) $OPTION=$DEFAULT_CMD; // If $OPTION is valid, search for the filename that starts with number=$OPTION if( $OPTION>0 ){ $FILE_NAME="XX"; // This is needed so the second part of the && in the following // while statement will evaluate to true the first pass through the while. // Get the filename of the command to be executed while( (int)$FILE_NAME!=$OPTION && $FILE_NAME ) $FILE_NAME=readdir($CMD_DIR); // Include the file to be executed into this script include($COMMAND_DIR."/".$FILE_NAME); } // Insert footer between ==> and <== //==> //<== // Send buffered output and stop output buffering ob_end_flush(); ?>