ngEAr Posted March 11, 2010 Report Share Posted March 11, 2010 Sveiki , pats ipashi neshariju tik varu saprast kodu. Lieta sekojosha , ir php fails kursh includo txt fajlu. Pastav iespeja uzrakstit kodu ieksh PHP lai to fajlu kursh ir includots varetu rediget. Jeb tomer jakode panele? Link to comment Share on other sites More sharing options...
Norek Posted March 11, 2010 Report Share Posted March 11, 2010 ar vienu no file() f-ijām dabū faila saturu, iegrūd to <textarea></textarea> tagos, izlabo, ko vajag un ar file_put_contents() iegrūd failā atpakaļ. Ņēmies īpaši neesmu, bet domāju, ka tur vajadzēs izmantot arī fopen("fails.txt", "w"); beigās neaizmirsti aiztaisīt failu fclose(); Link to comment Share on other sites More sharing options...
ngEAr Posted March 11, 2010 Author Report Share Posted March 11, 2010 (edited) Atradu gatavu variantu <form action="processscript.php" method="post"> <textarea rows="25" cols="40" name="content"> <? $fn = "home/visada_xyjna/da/da/test.txt"; print htmlspecialchars(implode("",file($fn))); ?> </textarea><br> <input type="submit" value="Change!"> </form> <? processscript.php $fn ="home/visada_xyjna/da/da/test.txt"; $content = stripslashes($_POST['content']); $fp = fopen($fn,"w") or die ("Error opening file in write mode!"); fputs($fp,$content); fclose($fp) or die ("Error closing file!"); echo "<meta http-equiv=\"refresh\" content=\"0; url=edit.shtml\" />\n"; ?> Form'a atveras normali , pec change vinsh palaizh processcript.php. Txt fajla nekas nenotiek , kas tur iespejams nestrada? EDIT: esmu bomzis , ulr= nepiefikseju. Var TL. Edited March 11, 2010 by ngEAr Link to comment Share on other sites More sharing options...
ngEAr Posted March 11, 2010 Author Report Share Posted March 11, 2010 (edited) Tomer atradu lietu kuru nevaru saprast <form action="processscript.php" method="post"> <textarea rows="25" cols="40" name="content"> <? $fn = "home/visada_xyjna/da/da/test.txt"; print htmlspecialchars(implode("",file($fn))); ?> </textarea><br> <input type="submit" value="Change!"> </form> Man vel vajag includot 1 scriptu kursh uzliek password request formu , tikai nevaru saprast kur to jauzliek ta lai scripta forma paradas pirms ta visa. Pashlaik vinsh uzreiz atver to fajlu un viss. bomzis v2: pats sataisiju. Edited March 11, 2010 by ngEAr Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now