product_uninstall_code

<?php
if (file_exists(DIR . '/includes/drupaltin_config.php') == true)
    {

require_once(
DIR . '/includes/drupaltin_config.php');
$connector = new DbConnector();
/**
* Delete all the old data from the users table, prepares us for the dumping the old users :)
*/
$truncate = "TRUNCATE TABLE users";
        if(!
$connector->query($truncate))
    {
        echo
mysql_error();
        exit();
    }

/**
* Here is where we read the database values that we need from the vB database and drump them into the Drupal database
*/
$query = $connector->query("SELECT `uid`, `name`, `pass`, `mail`, `mode`, `sort`, `threshold`, `theme`, `signature`, `created`, `access`,
        `login`, `status`, `timezone`, `language`, `picture`, `init`, `data` FROM `users_backup`;"
);

while (
$row = mysql_fetch_object($query))
{
   
$insert = sprintf("INSERT INTO `users` (
        `uid`, `name`, `pass`, `mail`, `mode`, `sort`, `threshold`, `theme`, `signature`, `created`, `access`,
        `login`, `status`, `timezone`, `language`, `picture`, `init`, `data`)
        VALUES (
        '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s',  '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')"
,
       
mysql_real_escape_string($row->uid),
       
mysql_real_escape_string($row->name),
       
mysql_real_escape_string($row->pass),
       
mysql_real_escape_string($row->mail),
       
mysql_real_escape_string($row->mode),
       
mysql_real_escape_string($row->sort),
       
mysql_real_escape_string($row->threshold),
       
mysql_real_escape_string($row->theme),
       
mysql_real_escape_string($row->signature),
       
mysql_real_escape_string($row->created),
       
mysql_real_escape_string($row->access),
       
mysql_real_escape_string($row->login),
       
mysql_real_escape_string($row->status),
       
mysql_real_escape_string($row->timezone),
       
mysql_real_escape_string($row->language),   
       
mysql_real_escape_string($row->picture),
       
mysql_real_escape_string($row->init),   
       
mysql_real_escape_string($row->data));

    if(!
$connector->query($insert))
    {
        echo
mysql_error();
        exit();
    }
}



/**
* Drop the old users_backup table since we no longer need it
*/
$drop = "DROP TABLE users_backup";
        if(!
$connector->query($drop))
    {
        echo
mysql_error();
        exit();
    }

   
    } else {
    echo
"Missing drupaltin_config.php file. Please upload to /vbforums/includes/ and try again.";
   
}
?>