...

View Full Version : Need help PHP-fusion to PCPIN chat user convertion script!



diload
01-18-2010, 08:59 PM
Hey all if there is anyone out that that know about PCPIN chat I would appreciate your help here :) I doubt that anyone would start to look into it's code just to help me here so I hope that if there is any who knows about it will assist me :)
And before I start explaining SORRY FOR MY MESSY CODE! this is like hell reading sometimes because I just created this for a one time run ...

okay then lets begin .. for some days I've been trying to convert users from a "PHP-fusion" database (A Open Source CMS system google it if you want to learn more) to the PCPIN chat Database but first of all every time I convert the users when I then load the chat login page it deletes them so I want to know what and where do I need to register stuff and is it possible just to load a couple of PCPIN's class files and call a function to create a user? I tried that but got a bunch of errors :(
and I've tried to look through all their code but it is a bit overwhelming for me :(

basic what I simply want is a way to create users manually.

but this is what I got so far :



<?php
// Connect to MySQL server
mysql_connect($mysql_host, $mysql_username, $mysql_password) or die('Error connecting to MySQL server: ' . mysql_error());
// Select database
mysql_select_db($mysql_database) or die('Error selecting MySQL database: ' . mysql_error());




$q1 = mysql_query("SELECT * FROM fusion_users");
$usnm = array();
$pass = array();
$levl = array();
$mail = array();
$hima = array();
$number = 0;
while($row = mysql_fetch_assoc($q1)):
$usnm[$number] = $row['user_name'];
$pass[$number] = $row['user_password'];
$levl[$number] = $row['user_level'];
$mail[$number] = $row['user_email'];
$hima[$number] = $row['user_hide_email'];
$number++;
endwhile;
$number = $number - 1;
mysql_select_db($msdb2) or die('Error selecting MySQL database: ' . mysql_error());


while($number >= 0):
$isadmin = ($levl[$number] > 101 ? "y" : "n");
$newpass = md5($pass[$number]);
$color = ($isadmin == "y" ? "ff0000" : "000000");
$nickname = "^" . $color . $usnm[$number];
$naame = $usnm[$number];

$q = mysql_query("INSERT INTO pcpin_user (login, password, email, hide_email, activated, is_admin, moderated_rooms, moderated_categories, banned_by, muted_users, password_new) VALUES('$usnm[$number]', '$pass[$number]', '$mail[$number]', '$hima[$number]', 'y', '$isadmin', '', '', '0', '', '$newpass')") or print("Convertion of user: '$usnm[$number]', failed: " . mysql_error());
$q3 = mysql_query("SELECT * FROM pcpin_user WHERE login = '$naame'") or die(mysql_error());
$row123 = mysql_fetch_assoc($q3);
$user_id = $row123['id'];
$q2 = mysql_query("INSERT INTO pcpin_nickname (user_id, nickname, nickname_plain, `default`) VALUES('$user_id', '$nickname', '$usnm[$number]', 'y')") or print("&nbsp;&nbsp;&nbsp;Failed creating nick_name for user: '$usnm[$number]' : " . mysql_error());
if($q && $q2){
echo "Convertion of user: $usnm[$number], was successfull";
}

echo "<br />";
$number--;
endwhile;

echo "<br /><br />Convetion script end!";
?>

Again sorry for the code :(
(Ofcourse connection variables is declared before this code )

Thanks !:)

diload
01-24-2010, 09:04 PM
Got it resolved now but can't edit this thread by some reason ...

odinthorfreja
06-28-2011, 11:25 PM
Got it resolved now but can't edit this thread by some reason ...

and solution was? since i got the same problem :confused:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum