$targetuser = $impexconfig['target']['user']; $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);
// THIS IS A GARRUNTEED WAY TO TRASH YOU DB !!! // 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
echo $impex_phrases['delete_session_and_data']; echo $impex_phrases['action_4']; echo $impex_phrases['action_7']; echo $impex_phrases['action_9']; echo $impex_phrases['remove_importids']; echo $impex_phrases['action_5']; echo $impex_phrases['action_8']; echo $impex_phrases['action_10']; echo $impex_phrases['action_6']; } if ($_GET['action'] == 'delsess') { echo $impex_phrases['dell_session_1']; echo $impex_phrases['dell_session_2']; echo $impex_phrases['dell_session_3']; echo $impex_phrases['dell_session_4']; $Db_target->query("DELETE FROM {$targettableprefix}datastore WHERE title='ImpExSession';"); echo $impex_phrases['dell_session_5']; echo $impex_phrases['dell_session_6']; } if ($_GET['action'] == 'delall') { echo $impex_phrases['deleting_session']; $Db_target->query("DELETE FROM {$targettableprefix}datastore WHERE title='ImpExSession';"); echo $impex_phrases['session_deleted']; foreach ($target as $tablename => $colname) { $Db_target->reporterror = 0; $is_it_there = $Db_target->query_first("DESCRIBE {$targettableprefix}{$tablename} {$colname}"); $Db_target->reporterror = 1; if ($is_it_there) { echo $impex_phrases['deleting_from'] . " {$targettableprefix}{$tablename} ...."; flush(); $Db_target->query("DELETE FROM {$targettableprefix}{$tablename} WHERE {$colname} <> 0");
// Jerry - jerry.hutchings@vbulletin.com 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'; }