• Read & Edit .Lua files in PHP
    8 replies, posted
Inside a .php file i want to be able to edit a .lua file I can make it so it edit's .txt files, but how do i edit .lua in PHP? The code for the read.txt files is.. processscript.php; [code] <? $fn = "C:/Program Files/Xampp/htdocs/editphp/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!"); ?> [/code] and form.php; [code] <form action="processscript.php" method="post"> <textarea rows="25" cols="40" name="content"> <? $fn = "C:/Program Files/Xampp/htdocs/editphp/test.txt"; print htmlspecialchars(implode("",file($fn))); ?> </textarea><br> <input type="submit" value="Change!"> </form> [/code] Can someone help me with this? Thanks!
Just replace .txt with .lua and you're good.
yeah what was so complicated about that
[QUOTE=compwhizii;21764491]yeah what was so complicated about that[/QUOTE] Some people = :downs:
lol! Didn't work when I did that. 'Obviously' i tried that.
What was the error then? fopen doesn't care what the extension is so you must have fucked something up somewhere else when you did that.
pro thread guys, keep it up
There probably wasn't a test.lua in that folder.
You can close it now, I wasn't selecting the write directory. Cheers anyway! =P
Sorry, you need to Log In to post a reply to this thread.