OK, how does this look?
<?php
// Seach all messages for a string and replace with another
$seachfor = "Frank";
$replacewith = "FRANK";
set_time_limit(-1);
ini_set('memory_limit', '128M');
include("./GLOBALS.php");
include("./fuddata/scripts/fudapi.inc.php");
$c = q("SELECT * FROM ${DBHOST_TBL_PREFIX}msg");
while ($r = db_rowobj($c)) {
echo "ID=[" . $r->id . "], POSTER=[" . $r->poster_id . "], SUBJECT=[" . $r->subject . "]<br/>\n";
$fp = fopen($GLOBALS['MSG_STORE_DIR'].'msg_'.$r->file_id, 'rb');
fseek($fp, $r->foff);
$body = fread($fp, $r->length);
if (($p = strpos($body, $seachfor)) !== false) {
$body = str_replace($seachfor, $replacewith, $body);
echo "NEW BODY=[" . $body . "]<hr>\n";
// fud_update_message($r->subject, $body, 0, $r->poster_id, $r->id);
}
}
?>
Note that the update function is still commented out!
Best regards.
Frank