View Single Post
Old 04-13-2004, 07:38 AM   #2
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Hi. Here's one way to do it.
PHP Code:
<?php

$filename 
"filename.ext";
$oldtext "old text";
$newtext "new text";

if (
is_writable($filename)) {
    
$buffer implode(""file($filename));
    
$buffer str_replace($oldtext$newtext$buffer);
    
$handle fopen($filename"wb");
    
fwrite($handle$buffer);
    
fclose($handle);
}
else {
    
clearstatcache();
    echo 
"Cannot write to ".$filename." - Check permissions.";
}

?>
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote