Save as ubbfixdate.php, upload to admin and run in browser.
(back-up your database first!!!)
PHP Code:
<?
require("./global.php");
if (!isset($action)) {
echo("This script will correct the dates on threads which were imported from UBB5.4x. Make sure you backup your database before proceeding!<br>");
echo("If you have a backup, <a href=\"fixubbdate.php?action=doconvert\">click here</a> to proceed.");
}
if ($action=="doconvert") {
$threads=$DB_site->query("SELECT MIN(post.postid),post.dateline AS dateline,post.threadid AS id,thread.threadid FROM post,thread WHERE post.threadid=thread.threadid GROUP BY thread.threadid ORDER BY thread.threadid ASC");
echo("Line inserted on purpose<br>Rows in result: ");
echo(mysql_num_rows($threads));
while ($thread=$DB_site->fetch_array($threads)) {
$DB_site->query("UPDATE thread SET dateline='$thread[dateline]' WHERE threadid='$thread[id]'");
echo(mysql_affected_rows());
$i++;
if ($i==50) {
echo("Updated another 50 threads...continuing<br>");
$i = 0;
}
}
} else {
echo("Done.");
}
?>