K33nny
05-31-2002, 01:35 PM
http://www.vbulletin.com/forum/showthread.php?threadid=33272&highlight=tforum
When running the first script for Pyro's tForum hack I get an error which is as followed...
removed
This is the "user" transfer script.
removed
What exactly is going wrong and how do I fix it?
Admin
05-31-2002, 01:57 PM
I know what the problem is, it's not using the target database but only the tForum. I'll post a new script in a couple of hours or so...
K33nny
05-31-2002, 01:59 PM
Thanks man. I feel kind of stupid asking so many questions about PHP, but I'm only in the learning process.
Admin
05-31-2002, 04:55 PM
Well, try this.
Bear in mind I don't know tForum at all, I just fixed the script above to really use two databases. It might or it might not work, it's not been tested.
Hmm, can't read from A:\... it's been a year since I used it, and now when I do it doesn't work. :mad:
Anyway, I wrote it on my laptop so it's on a floppy, I'll try and get it fixed soon.
Admin
05-31-2002, 05:02 PM
Here we go... :)
<?php
// tForum > vBulletin Transfer script for "user"
// Written by Pyro for <a href="http://www.feuerwerk.net" target="_blank">http://www.feuerwerk.net</a>
$db_Database = 'ewi_forums'; // name of database
$db_Database_target = 'ewi_planet'; // enter the same
$db_UserName = 'ewi_ewp'; // username or root
$db_UserName_target = 'ewi_planet'; // enter the same
$db_Password = '3wplan3t'; // password for root or user
$db_Password_target = 'plan3t'; // enter the same
$db_Hostname = 'localhost'; // e.g. "localhost"
################################################## #############
################################################## #############
################################################## #############
$link = mysql_connect($db_Hostname, $db_UserName, $db_Password);
if (!$link) {
echo 'No connection to database.';
}
mysql_select_db($db_Database, $link);
$query = 'SELECT * FROM t_users ORDER BY ID ASC';
$result = mysql_query($query, $link);
echo "Transfer Users from tForum to vBulletin<br /><br />\n";
while ($user = mysql_fetch_array($result)) {
$userq[$user['ID']] = 'INSERT INTO user (userid, usergroupid, username, password, email, styleid, parentemail, coppauser, ';
$userq[$user['ID']] .= 'homepage, icq, aim, yahoo, signature, adminemail, showemail, invisible, usertitle, customtitle, ';
$userq[$user['ID']] .= 'joindate, cookieuser, daysprune, lastvisit, lastactivity, lastpost, posts, timezoneoffset, ';
$userq[$user['ID']] .= 'emailnotification, buddylist, ignorelist, pmfolders, receivepm, emailonpm, pmpopup, avatarid, ';
$userq[$user['ID']] .= 'options, birthday, maxposts, startofweek, ipaddress, referrerid, nosessionhash) VALUES (';
$userq[$user['ID']] .= "'$user[ID]', ";
if ($user['ID'] == 1) {
$userlevel = 6;
} else {
$userlevel = 2;
}
$userq[$user['ID']] .= "'$userlevel', "; // alle User=registriert
$userq[$user['ID']] .= "'$user[UserName]', ";
$userq[$user['ID']] .= "'$user[Password]', ";
$userq[$user['ID']] .= "'$user[Email]', ";
$userq[$user['ID']] .= "'0', ";
$userq[$user['ID']] .= "'', ";
$userq[$user['ID']] .= "'0', ";
$userq[$user['ID']] .= "'$user[Homepage]', ";
if ($user['ICQNumber'] == 0) {
$icq = '';
} else {
$icq = $user['ICQNumber'];
}
$userq[$user['ID']] .= "'$icq', ";
$userq[$user['ID']] .= "'', ";
$userq[$user['ID']] .= "'', ";
$userq[$user['ID']] .= "'$user[Signature]', ";
$userq[$user['ID']] .= "'1', ";
$userq[$user['ID']] .= "'1', ";
$userq[$user['ID']] .= "'0', ";
$userq[$user['ID']] .= "'', ";
$userq[$user['ID']] .= "'0', ";
$userq[$user['ID']] .= "'$user[RegDate]', ";
$userq[$user['ID']] .= "'1', ";
$userq[$user['ID']] .= "'-1', ";
$userq[$user['ID']] .= "'$user[LastActive]', ";
$userq[$user['ID']] .= "'$user[LastActive]', ";
$userq[$user['ID']] .= "'', "; //lastpost
$userq[$user['ID']] .= "'$user[NumPost]', ";
$userq[$user['ID']] .= "'+2', ";
$userq[$user['ID']] .= "'1', ";
$userq[$user['ID']] .= "'', ";
$userq[$user['ID']] .= "'', ";
$userq[$user['ID']] .= "'', ";
$userq[$user['ID']] .= "'1', ";
$userq[$user['ID']] .= "'1', ";
$userq[$user['ID']] .= "'0', ";
$userq[$user['ID']] .= "'0', ";
$userq[$user['ID']] .= "'15', ";
$userq[$user['ID']] .= "'', ";
$userq[$user['ID']] .= "'-1', ";
$userq[$user['ID']] .= "'2', ";
$userq[$user['ID']] .= "'', ";
$userq[$user['ID']] .= "'0', ";
$userq[$user['ID']] .= "'1')";
$userfieldq[$user['ID']] = "INSERT INTO userfield (userid) VALUES ($user[ID])";
}
mysql_close($link);
################################################## #############
################################################## #############
################################################## #############
$link = mysql_connect($db_Hostname, $db_UserName_target, $db_Password_target);
if (!$link) {
echo 'No connection to database.';
}
mysql_select_db($db_Database_target, $link);
foreach ($userq as $userID => $nevermind) {
// Enter in Table user
echo $userq[$userID] . '<br /><br />';
if (!$transfer_user = mysql_query ($userq[$userID])) {
echo "<font color=\"red\"><b>... Error!</b></font>";
echo mysql_error();
}
// Enter in Table userfield
echo $userfieldq[$userID] . '<br /><br />';
if (!$transfer_user = mysql_query ($userq[$userID])) {
echo "<font color=\"red\"><b>... Error!</b></font>";
echo mysql_error();
}
}
mysql_close($link);
?>
K33nny
05-31-2002, 09:15 PM
removed
This is what things looked like when I ran your updated script. It transferred the first then caused an error for each one after.
Instead it would be ... Error!Duplicate entry '3' then ... Error!Duplicate entry '4' and so on.
K33nny
06-01-2002, 01:11 AM
Getting this error when running 3_transfer_mess.php3
removed
removed
In order to not get that error should I have someone with a quicker connection run this script?
removed
Admin
06-01-2002, 06:36 AM
For post #6:
You already ran the script, so some users are already in the user table. Empty the table (using phpMyAdmin) and run the script again.
UNLESS you already had users before trying to import. In that case the script won't work.
For post #7:
The script is taking too much time to execute, so stick this line:
set_time_limit(0);
right at the beginning, after <?php.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.