Results Files: section."); } if(!(isset($instr))){ if(file_exists("$INC_PATH/st.php")) include "$INC_PATH/start.php"; die("Please login again."); } $file = "$INS_PATH/$instr/$crsid"; $tempFile = "$INS_PATH/$instr/temp.file"; $file1 = "$INS_PATH/$instr/files.txt"; if(!($fp = fopen($file1,"r"))) die("Could not open files.txt"); else $lock = flock($fp,LOCK_SH); if($lock){ while(!feof($fp)){ $buffer = fgets($fp,16); $buffer1 = trim($buffer); if (strcmp($buffer1,trim($crsid))){ if(!($fp1 = fopen("$tempFile","aw"))) die("Could not create the temp file in the $instr directory"); if(strlen(trim($buffer1)) > 1) fwrite($fp1,"$buffer1\n"); } } } $lock = flock($fp,LOCK_UN); fclose($fp); fclose($fp1); if(file_exists($file)) unlink($file); else die("Could not delete $crsid"); if(file_exists($file1)) unlink($file1); else die("Could not delete files.txt from $instr's directory"); if(!(file_exists($file1))){ chmod($tempFile,octdec(646)); rename($tempFile,$file1); } else die("files.txt was not deleted. Move of temp file was not performed."); if(file_exists($file1)){ if(file_exists("$INC_PATH/instSt.php")) include "$INC_PATH/instSt.php"; else error("instructStart"); } ?>