#!/usr/local/bin/php -q query(" // INSERT INTO invoice_tbl ( // client_id, // invoice_type, // invoice_date, // invoice_amount, // invoice_status, // payment_type, // invoice_text, // email_sent_datetime, // added_datetime // ) VALUES ( // '" . $db->escapeString(0) . "', // '" . $db->escapeString('hosting') . "', // '" . $db->escapeString($file_date) . "', // '" . $db->escapeString($amt[1]) . "', // '" . $db->escapeString('Paid') . "', // '" . $db->escapeString('') . "', // '" . $db->escapeString($file_text) . "', // '" . $db->escapeString($file_date) . "', // NOW() // ) // "); } else { $app->logMsg('Could not open file: ' . $file, LOG_INFO, __FILE__, __LINE__); } } $app->logMsg('Proccessing complete: ' . $file_count . ' files total.', LOG_INFO, __FILE__, __LINE__); } else { $app->logMsg('No files available in that directory.', LOG_INFO, __FILE__, __LINE__); } /** * Find all files in directories recursivly with a specified file extension. * * @param string $dir the full path to the directory to scan * @param array $valid_extensions valid extensions * @param int $recurs_lev how many levels deep to scan. Set this * to a low number to prevent infinite loops * * @return array multi-dimentional array of found files on success */ function getFilesRecursive($dir, $recurs_lev=0, $return=true) { static $output; $dir_handle = opendir($dir); while ($dir_handle && ($file = readdir($dir_handle)) !== false) { if (!preg_match('/^\./', $file)) { if (is_dir($dir . '/' . $file) && $recurs_lev > 0) { getFilesRecursive($dir . '/' . $file, $valid_extensions, $recurs_lev - 1); } else if (!is_dir($dir . '/' . $file)) { $output[] = $dir . '/' . $file; } } } if ($return) { return $output; } } ?>