$ytd_cnt = 18; $findFlag = "not_yet"; $ff_ytd = $ytd; $file = "$INS_PATH/$instr/$crsid"; echo "
"; if(!($fp = fopen($file, "r"))) die("Unable to open the input file"); while (!feof($fp)) { $buffer = fgets($fp,30000); $i = 0; $ytdText = "YEAR-TO-DATE FILE LISTING"; $csn1 = "COURSE SEQUENCE NUMBER"; $sum = "COURSE SUMMARY"; $xtcrd = trim(substr($buffer,120,3)); $tstrv = trim(substr($buffer,114,4)); $total = trim(substr($buffer,127,4)); $no = trim(substr($buffer,6,3)); $name = substr($buffer,10,15); $soc = trim(substr($buffer,28,11)); $ySText = substr($buffer,45, 25); $numText = trim(substr($buffer,5,3)); if ($findFlag == "not_yet"){ if (strcmp($ytdText,$ySText) == 0) $findFlag = "yes"; } elseif ($findFlag == "yes") { if (is_numeric($numText)){ $ytds = ""; while($i < $ytd_cnt){ $j = ($i * 4 + 41); $ytdi = trim(substr($buffer,$j,3)); if (!(strlen($ytdi)) > 0) $ytdi = 0; $ytds = $ytds . $ytdi . ","; $i++; } if (!(strlen($soc)) > 0) $soc = ""; if (!(strlen($tstrv)) > 0) $tstrv = 0; if (!(strlen($xtcrd)) > 0) $xtcrd = 0; if (is_numeric($no)){ echo $no . ",\"" . $name . "\",\"" . $soc . "\"," . $ytds . $tstrv . "," . $xtcrd . "," . $total . "\n"; } } } } fclose($fp); if($findFlag == "not_yet") { echo "No YTD Information found for $crsid\n"; if (file_exists("$INC_PATH/instSt.php")) include "$INC_PATH/instSt.php"; else die("Could not include instSt.php"); } ?>