"; //Begin Center Stack div. // $current_dir = "/home/brigandine/public_html/weblogs/"; $current_dir = "./"; //Path to directory containing all files. $dir = opendir($current_dir); echo "

\n"; // Form should submit to itself. echo "\n"; echo "\n"; echo "
\n"; echo "

"; // Depending on how the server is setup PHP versions 4.1.0 supports the $_POST array. // The $HTTP_POST_VARS will work with earlier versions of PHP but is not a super global. // if register_globals is turned off you will need to put global $HTTP_POST_VARS // at the top of the script for it to work. // Change at your own risk. if(isset($HTTP_POST_VARS['Filename'])){ // Only display output if the form has been submitted. $filename = $HTTP_POST_VARS['Filename']; //here's the filename $id = fopen($filename, "r"); //open the file echo "Here's what " . $filename . " has to say.....
"; while ($data = fgetcsv($id, filesize($filename))) //start a loop $table[] = $data; //put each line into its own entry in the $table array fclose($id); //close file $records = count($table); //Get the number of entries in the table array $max_fields = count($table[0]); //Get the number of fields in the table array for($row=$records-1; $row>0; $row--){ //Loop bass ackwards echo "

\n"; for($field=0; $field<$max_fields; $field++){ //Loop through the fields switch($field) { //Field specific formatting case 0: echo "
\n" . $table[$row][$field] . "\n
\n"; break; case 1: echo "
\n" . $table[$row][$field] . "\n
\n"; break; default: echo "
\n" . $table[$row][$field] . "\n
\n"; } // End Switch } // End field loop echo "
\n"; // End Comment div } // End bass ackwards For loop } // End form submitted check. ?>
PHP stuff written by Cecil Cosman, C stuff written by John Powell, hosted by Scott Myers.
All comments are owned by the people who said by them. Blog engine syndicate 2004. :)