Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > BT.Manager (phpMyBitTorrent) > Mods & Themes
Reply
  #1  
Old 21st February 2009, 18:05
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default Import TBDev user's to PMBT
this well import user's from most TBDev based sources!!!
was also tested on TSSE 5.1 and imported 2498 users successfully.
First you need to make sure that the PMBT user table only has one user (id # 1 wich is you the admin) and you need to remove user id# 1 from TBDev wich should also be you if you are anouther id # you well want to remove that one and id#1.
this well stop cross ID's.
Remeber all users well need to recover there user password!!
AND there passkey well be replaced with a new one

PHP Code:
<?php
include("header.php");

# Table Names
$old_tableprefix "users"// Old table name
$new_tableprefix "div_users"//New Table Name

$query $db->sql_query("SELECT id, username, email, added, secret, passhash, uploaded, downloaded, gender, status FROM {$old_tableprefix}") or sqlerr(__FILE__,__LINE__);

OpenTable("User Import");
echo 
"I will try to update user table --> ";
$count=0;
while (
$olduser $db->sql_fetchrow($query))
{
$id $olduser['id'];
$username $olduser['username'];
$email $olduser['email'];
$added $olduser['added'];
$uploaded $olduser['uploaded'];
$downloaded $olduser['downloaded'];
$tempass RandomAlpha(8)
$act_key RandomAlpha(32);
$status = ($olduser['status']=="confirmed")? :0;
                                                                        if(
$force_passkey){
                                                                                        do {
                                                                                                
$passkey ", '".RandomAlpha(32)."'";
                                                                                                
//Check whether passkey already exists
                                                                                                
$sqll "SELECT passkey FROM ".$new_tableprefix." WHERE passkey = '".$passkey."';";
                                                                                                
$resl mysql_query($sqll)OR print("error");
                                                                                                
$cnt = @mysql_num_rows($sqll);
                                                                                                @
mysql_free_result($resl);
                                                                                        } while (
$cnt 0);
                                                                                        
$passkeyrow ', passkey';
                                                                                        }else{
                                                                                        
$passkeyrow NULL;
                                                                                        
$passkey NULL;
                                                                                        }



$sqlnew "INSERT INTO ".$new_tableprefix." (id,username,clean_username,email,regdate,password,act_key,uploaded,downloaded,active".$passkeyrow.")
VALUES ('
$id', '$username', '".strtolower($username)."', '$email', '$added', '$tempass', '$act_key', '$uploaded', '$downloaded', '$status$passkey)";
$gonew $db->sql_query($sqlnew);
if(!
$gonew)echo "<br>Error:<br>Not able to creat ".$username." Maybe a duplicate Intry<br>";
$count++;
}

echo 
"Done..<br><br>Total {$count} users has been updaded...<br>Note: All users should recover their password...";
CloseTable();
include(
"footer.php");
?>
Now edit
PHP Code:
$old_tableprefix "users"// Old table name
$new_tableprefix "div_users"//New Table Name 
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
The Following 2 Users Say Thank You to joeroberts For This Useful Post:
adrian21 (9th April 2009), Fynnon (21st February 2009)
  #2  
Old 9th October 2012, 10:26
adora adora is offline
Member
 
Join Date: Oct 2012
P2P
Posts: 1
Default
PHP 5.4
Pmbt 2.0.4 gold

i had to change the code a bit and its now tested with TSSE 7.2
Database count was 16120 user's, and the site now has 16098, I had to run the script about 6 times looks like it would do about 4k at a time. i ran it a few extra times to confirm it was done. I also have to double check my database numbers but i think that is what it was.

PHP Code:
<?php
if (defined('IN_PMBT'))die ("You can't include this file");
define("IN_PMBT",true);  
include(
"header.php");

# Table Names
$old_tableprefix "users"// Old table name
$new_tableprefix "torrent_users"//New Table Name

$query $db->sql_query("SELECT id, username, email, added, secret, passhash, uploaded, downloaded, status FROM {$old_tableprefix}") or sqlerr(__FILE__,__LINE__);

OpenTable("User Import");
echo 
"I will try to update user table --> ";
$count=0;
while (
$olduser $db->sql_fetchrow($query))
{
$id $olduser['id'];
$username $olduser['username'];
$email $olduser['email'];
$added $olduser['added'];
$uploaded $olduser['uploaded'];
$downloaded $olduser['downloaded'];
$tempass RandomAlpha(8);
$act_key RandomAlpha(32);
$status = ($olduser['status']=="confirmed")? :0;
                                                                        if(
$force_passkey){
                                                                                        do {
                                                                                                
$passkey ", '".RandomAlpha(32)."'";
                                                                                                
//Check whether passkey already exists
                                                                                                
$sqll "SELECT passkey FROM ".$new_tableprefix." WHERE passkey = '".$passkey."';";
                                                                                                
$resl mysql_query($sqll)OR print("error");
                                                                                                
$cnt = @mysql_num_rows($sqll);
                                                                                                @
mysql_free_result($resl);
                                                                                        } while (
$cnt 0);
                                                                                        
$passkeyrow ', passkey';
                                                                                        }else{
                                                                                        
$passkeyrow NULL;
                                                                                        
$passkey NULL;
                                                                                        }



$sqlnew "INSERT INTO ".$new_tableprefix." (id,username,clean_username,email,regdate,password,act_key,uploaded,downloaded,active".$passkeyrow.")
VALUES ('
$id', '$username', '".strtolower($username)."', '$email', '$added', '$tempass', '$act_key', '$uploaded', '$downloaded', '$status$passkey)";
$gonew $db->sql_query($sqlnew);
if(!
$gonew)echo "<br>Error:<br>Not able to creat ".$username." Maybe a duplicate Intry<br>";
$count++;
}

echo 
"Done..<br><br>Total {$count} users has been updaded...<br>Note: All users should recover their password...";
CloseTable();
include(
"footer.php");
?>

Last edited by adora; 9th October 2012 at 12:53.
Reply With Quote
Reply

Tags
import , pmbt , tbdev , user

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Import Users Fynnon Mods & Themes 7 6th August 2013 09:38
Import TBdev & TT torrents to phpMyBitTorrent joeroberts Mods & Themes 1 12th November 2010 05:39
Import Users Tbdev Netmaniack 1.6 to Yuna Scatari v2.0 r 2.1 Izacic Yuna Scatari Edition (YSE) 0 21st February 2009 19:26
Import Users TT --> TS zape Template Shares 0 23rd October 2008 18:23
Import Users Swompen Template Shares 0 30th July 2008 06:32



All times are GMT +2. The time now is 12:56. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.