Results Files: section."); } if(!(isset($instr))){ if(file_exists("$INC_PATH/st.php")) include "$INC_PATH/st.php"; } $file1 = "$INS_PATH/$instr/files.txt"; $tempFile = "$INS_PATH/$instr/temp.file"; $findFlag = "no"; if(!($fp = fopen($file1, "r"))) die("Where did files.txt go?"); else $lock = flock($fp,LOCK_SH); if(!($fp1 = fopen("$tempFile","w+"))) die("Could not create the temp file in $instr directory"); if($lock){ while (!feof($fp)) { $buffer = fgets($fp,20); $course = trim($buffer); if(strlen($course) > 1){ if($course == $crsid){ $findFlag = "yes"; } else { fputs($fp1,"$buffer"); } } } } $lock = flock($fp,LOCK_UN); fclose($fp); if($findFlag == "no") fputs($fp1,"$crsid\n"); fclose($fp1); unlink($file1); if(!(file_exists($file1))){ chmod($tempFile,octdec(646)); rename($tempFile,$file1); } else { die("files.txt was not deleted. Move of temp file over was not performed"); } if(file_exists($file1)){ if(file_exists("$INC_PATH/instSt.php")) include "$INC_PATH/instSt.php"; else error("instrucStart.php"); } ?>