Lol5916 Posted August 24, 2008 Share Posted August 24, 2008 $p = $_POST['log'] $l = file_put_contents(file.php) $log = str_replace("replace", "", $l) How do I make it so that the word "replace" in "file.php" get's replaced by the output of $p?(form "log") Link to comment https://forums.phpfreaks.com/topic/121104-help/ Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 do you not need to do , fopen and fwrite. Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624323 Share on other sites More sharing options...
DarkWater Posted August 24, 2008 Share Posted August 24, 2008 No Blade, he can just use file_put_contents(). Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624326 Share on other sites More sharing options...
Lol5916 Posted August 24, 2008 Author Share Posted August 24, 2008 So how do you use that to use file_put_contents with str_replace to edit something in a file? Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624328 Share on other sites More sharing options...
unrelenting Posted August 24, 2008 Share Posted August 24, 2008 $p = $_POST['log'] $l = file_get_contents(file.php) $log = str_replace("replace", "", $l) How do I make it so that the word "replace" in "file.php" get's replaced by the output of $p?(form "log") Try: $p = $_POST['log'] $l = file_get_contents(file.php) $log = str_replace("replace", $p, $l) Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624329 Share on other sites More sharing options...
DarkWater Posted August 24, 2008 Share Posted August 24, 2008 @unrelenting: You actually need to save the file though. =P Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624333 Share on other sites More sharing options...
unrelenting Posted August 24, 2008 Share Posted August 24, 2008 @unrelenting: You actually need to save the file though. =P I guess I just don't understand what that code is doing. I just assumed he just wanted that str_replace edited to suit his needs. :-\ Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624336 Share on other sites More sharing options...
Lol5916 Posted August 24, 2008 Author Share Posted August 24, 2008 I have code in a file that needs to be edited with information from user input. Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624338 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.