Пример #1
0
$targetpassword = $impexconfig['target']['password'];
$targetdatabase = $impexconfig['target']['database'];
$targettableprefix = $impexconfig['target']['tableprefix'];
$targettablecharset = $impexconfig['target']['charset'];
$Db_target = new DB_Sql_vb_impex();
$Db_target->appname = 'vBulletin:ImpEx Target';
$Db_target->appshortname = 'vBulletin:ImpEx Target';
$Db_target->type = 'mysql';
$Db_target->database = $targetdatabase;
$Db_target->connect($targetserver, $targetuser, $targetpassword, 0, $targettablecharset);
$Db_target->select_db($targetdatabase);
// BACK UP YOUR DATABASE
# Posts
if ($do_posts) {
    $posts = $Db_target->query("SELECT postid, pagetext, title FROM " . $targettableprefix . "post");
    while ($post = $Db_target->fetch_array($posts)) {
        $text = str_replace(array_keys($replacer), $replacer, $post['pagetext']);
        $title_text = str_replace(array_keys($replacer), $replacer, $post['title']);
        #$text = preg_replace('##siU', '', $text);
        #$title_text = preg_replace('##siU', '', $text);
        $Db_target->query("UPDATE " . $targettableprefix . "post SET pagetext='" . addslashes($text) . "', title='" . addslashes($title_text) . "' WHERE postid='" . $post['postid'] . "'");
        echo "<br /><b>Post done -></b><i> " . $post['postid'] . "</i>";
    }
}
# Signatures
if ($do_sigs) {
    $users = $Db_target->query("SELECT userid, signature FROM " . $targettableprefix . "usertextfield");
    while ($user = $Db_target->fetch_array($users)) {
        $text = str_replace(array_keys($replacer), $replacer, $user['signature']);
        #$text = preg_replace('##siU', '', $text);
        $Db_target->query("UPDATE " . $targettableprefix . "usertextfield SET signature='" . addslashes($text) . "' WHERE userid='" . $user['userid'] . "'");
Пример #2
0
// COMPLETLY INVALIDATES SUPPORT
// USE AT YOUR OWN RISK.
//
// I / we / the company takes no responsiability for you running this script
// Jerry - jerry.hutchings@vbulletin.com
define('DIR', ($getcwd = getcwd()) ? $getcwd : '.');
require_once DIR . '/db_mysql.php';
$Db_target = new DB_Sql_vb_impex();
$Db_target->server = 'localhost';
$Db_target->user = '******';
$Db_target->password = '******';
$Db_target->database = 'vb3';
$Db_target->connect();
$refrence_ids = array();
$ids = $Db_target->query("SELECT userid,importuserid FROM user where importuserid !='null'");
while ($id = $Db_target->fetch_array($ids)) {
    $refrence_ids[$id['userid']] = $id['importuserid'];
}
echo "<h4>Altering tables.........</h4>";
// ALTER TO UNSIGNED && DROP PRIMARY KEY
$Db_target->query("ALTER TABLE `user` CHANGE `userid` `userid` INT( 10 ) NOT NULL");
$Db_target->query("ALTER TABLE `user` DROP PRIMARY KEY");
echo "<p>User table.....</p>";
$Db_target->query("ALTER TABLE `customavatar` CHANGE `userid` `userid` INT( 10 ) NOT NULL");
$Db_target->query("ALTER TABLE `customavatar` DROP PRIMARY KEY");
echo "<p>User table.....</p>";
echo "<h4>Tables well the truly done now ........</h4>";
$i = 0;
foreach ($refrence_ids as $vb_user_id => $import_user_id) {
    // user vb_id -> importid
    $Db_target->query("UPDATE user SET userid='" . $import_user_id . "' WHERE userid='" . $vb_user_id . "'");
Пример #3
0
 
 while ($user = $Db_target->fetch_array($dupe_users))
 {
 	$user_to_delete[] = $user['userid'];
 }
 
 $users_found = count($user_to_delete);
 if ($users_found)
 {
 	$Db_target->query("DELETE FROM {$targettableprefix}user WHERE userid IN(" . implode(',', $user_to_delete) . ")");
 }
 */
 // Forums
 $forum_sql = "SELECT MAX(forumid) AS forumid, COUNT(*) AS count FROM {$targettableprefix}forum WHERE importforumid > 0 GROUP BY importforumid HAVING count > 1";
 $dupe_forums = $Db_target->query($forum_sql);
 while ($forum = $Db_target->fetch_array($dupe_forums)) {
     $forum_to_delete[] = $forum['forumid'];
 }
 $forums_found = count($forum_to_delete);
 if ($forums_found) {
     $Db_target->query("DELETE FROM {$targettableprefix}forum WHERE forumid IN(" . implode(',', $forum_to_delete) . ")");
 }
 // Threads
 $thread_sql = "SELECT MAX(threadid) AS threadid, COUNT(*) AS count FROM {$targettableprefix}thread WHERE importthreadid > 0 GROUP BY importthreadid HAVING count > 1";
 $dupe_threads = $Db_target->query($thread_sql);
 while ($thread = $Db_target->fetch_array($dupe_threads)) {
     $thread_to_delete[] = $thread['threadid'];
 }
 $threads_found = count($thread_to_delete);
 if ($threads_found) {
     $Db_target->query("DELETE FROM {$targettableprefix}thread WHERE threadid IN(" . implode(',', $thread_to_delete) . ")");
Пример #4
0
define('DIR', ($getcwd = getcwd()) ? $getcwd : '.');
require_once DIR . '/db_mysql.php';
$targettableprefix = '';
$targetdatabasetype = 'mysql';
$targetserver = 'localhost';
$targetuser = '******';
$targetpassword = '******';
$targetdatabase = 'vb3';
$Db_target = new DB_Sql_vb_impex();
$Db_target->server = $targetserver;
$Db_target->user = $targetuser;
$Db_target->password = $targetpassword;
$Db_target->database = $targetdatabase;
$Db_target->connect();
$data_base_result = $Db_target->query("show tables");
while ($table = $Db_target->fetch_array($data_base_result)) {
    if ($table[0] != 'vbfields') {
        echo "<h4>'" . $table[0] . "'</h4>";
        $table_result = $Db_target->query("DESCRIBE " . $table[0]);
        while ($row = $Db_target->fetch_array($table_result)) {
            // Check that it is in vBfields to start with
            $not_found = $Db_target->query_first("SELECT fieldid FROM vbfields WHERE fieldname='" . $row['Field'] . "' AND tablename='" . $table[0] . "'");
            if ($not_found[0] == null) {
                echo "<h2><font color='red'>I found field " . $row['Field'] . " in table '" . $table[0] . "' and not in vbfields !</font></h2>";
            }
            echo "<br /><i>updating</i> -|- <b>" . $row['Field'] . "</b> :: " . $row['Type'];
            $unsigned = 'NO';
            if (strstr($row['Type'], 'unsigned')) {
                $unsigned = 'YES';
            }
            if (strstr($row['Type'], 'char') or strstr($row['Type'], 'text') or strstr($row['Type'], 'enum')) {