PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am having al litle problem, i have created an an cfg file "config" file, in php. I now want to edit it on a website self, that means I have to open it.
When i am opening it, i must see the text in an textarea and when i am finished editing, it must also be saved again.
Can enybody help me with this subject, or at leest give me a push in the write direction?
Last edited by Skywalker on Thu May 22, 2003 6:12 am, edited 1 time in total.
These functions will, in order, open the config file, read the information from the config file, and place the new information you add in to the config file.
If have got a new problem, I now already have a script to open hthe file en write content to it. But when it writes the content to it, it als writes \\\ slashes or dashes wher ever ther are "". so that means my code is not enymore ok when it has been edited. because of the slashes and dashes.
<?php
$filename = $_POST['File'];
$somecontent = $_POST['Content'];
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'ab')) {
print "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (!fwrite($handle, $somecontent)) {
print "Cannot write to file ($filename)";
exit;
}
print "Bestand ge-edit";
fclose($handle);
} else {
print "The file $filename is not writable";
}
?>