Tag:io ar os sp for file data on cti
<form name= "Form1" method= "Post" action= "" > <label> <input type= "text" name= "title" > Title <br> <br> </label> <label> <textarea name= "content" cols= "Ro" ws= ></textarea> </label> content <p> <label> & nbsp; <input type= "Submit" name= "Submit" value= "Submission" > </label> </p> </form> <? if ($_post) { $file = ' list.txt '; $array = $_post; $content = "title:". $array [' title ']. ' content: '. $array [' Content '].CHR (13); if (File_exists ($file)) { Add_write ($content) Echo ' Save succeeded '; else Null_write ($content); } }
function Null_write ($new) {global $file; $f =fopen ($file, "w"); Flock ($f, LOCK_EX); Fputs ($f, $new); Fclose ($f); }//Add data record to file End Function Add_write ($new) {global $file; $f =fopen ($file, "a"); Flock ($f, LOCK_EX); Fputs ($f, $new); Fclose ($f); }/* fopen write file flock lock file, prevent simultaneous multi-person operation Fputs Write the file, write the content to the file fclose close the file */?>
PHP message board without a database