Help with db

Discussion in 'PHP' started by web@master24, Aug 5, 2009.

  1. #1
    Hi, im have a website using X10 MEDIA MP3 SEARCH ENGINE SCRIPT, and have one DB, and i want change to attmp3 search engine script but have other type of db, its possible import the registed users from one db to other? thanks you if someone can help me
     
    web@master24, Aug 5, 2009 IP
  2. khajeya

    khajeya Member

    Messages:
    256
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #2
    sure, its possible.. but, can you post here about the fields details of your tables ?
     
    khajeya, Aug 5, 2009 IP
  3. web@master24

    web@master24 Active Member

    Messages:
    418
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    90
    #3
    Here are the DB where the info is, this is te table users, where is located the registed users:

    --
    -- Table structure for table `users`
    --
    DROP TABLE IF EXISTS `users`;
    CREATE TABLE `users` (
      `username` varchar(30) NOT NULL,
      `password` varchar(32) default NULL,
      `userid` varchar(32) default NULL,
      `userlevel` tinyint(1) unsigned NOT NULL,
      `email` varchar(50) default NULL,
      `timestamp` int(11) unsigned NOT NULL,
      `downloads` int(11) NOT NULL default '0',
      PRIMARY KEY  (`username`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    
    --
    -- Dumping data for table `users`
    --
    
    INSERT INTO `users` VALUES('admin', '21232f297a57a5a743894a0e4a801fc3', '21232f297a57a5a743894a0e4a801fc3', 9, 'my@email.com', 2008, 0);
    Code (markup):
    and this is where i want import:

    $tableSchema[] = "CREATE TABLE " . PREFIX . "_users (
      `email` varchar(50) NOT NULL default '',
      `password` varchar(32) NOT NULL default '',
      `name` varchar(40) NOT NULL default '',
      `user_id` mediumint(8) NOT NULL auto_increment,
      `news_num` smallint(6) NOT NULL default '0',
      `comm_num` mediumint(8) NOT NULL default '0',
      `user_group` smallint(5) NOT NULL default '4',
      `lastdate` varchar(20) default NULL,
      `reg_date` varchar(20) default NULL,
      `banned` varchar(5) NOT NULL default '',
      `allow_mail` tinyint(1) NOT NULL default '1',
      `info` text NOT NULL,
      `signature` text NOT NULL,
      `foto` varchar(30) NOT NULL default '',
      `fullname` varchar(100) NOT NULL default '',
      `land` varchar(100) NOT NULL default '',
      `country` varchar(50) NOT NULL,
      `city` varchar(50) NOT NULL,
      `icq` varchar(20) NOT NULL default '',
      `favorites` text NOT NULL,
      `pm_all` smallint(5) NOT NULL default '0',
      `pm_unread` smallint(5) NOT NULL default '0',
      `time_limit` varchar(20) NOT NULL default '',
      `xfields` text NOT NULL,
      `allowed_ip` varchar(255) NOT NULL default '',
      `hash` varchar(32) NOT NULL default '',
      `useragent` char(100) NOT NULL,
      `logged_ip` varchar(16) NOT NULL default '',
      `logged_proxy` char(15) NOT NULL,
      `playlist` int(11) NOT NULL default '0',
      `song` int(11) NOT NULL default '0',
      `album` int(11) NOT NULL default '0',
      `blog` int(11) NOT NULL default '0',
      `video` int(11) NOT NULL default '0',
      `location` varchar(255) NOT NULL,
      PRIMARY KEY  (`user_id`),
      UNIQUE KEY `name` (`name`),
      UNIQUE KEY `email` (`email`)
    ) TYPE=MyISAM /*!40101 DEFAULT CHARACTER SET " . COLLATE . " COLLATE " . COLLATE . "_general_ci */";
    Code (markup):
    username -> name
    password -> password
    email -> email
    userid -> Here the problem is in the first table convert the userid to a VALUE LIKE: 21232f297a57a5a743894a0e4a801fc3 and the second db is only 1,2,3 etc.
    timestamp ->lastdate
    userlevel -> user_group

    If someone can help im be thanksful, thanks
     
    web@master24, Aug 5, 2009 IP
  4. khajeya

    khajeya Member

    Messages:
    256
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #4
    Hmm.. I think you must choose the type data of user_id, you can choose between integer or varchar, i not sure what kind of user_id data that used in old table, mayble it used MD5 encryption (from integer value, random value, or other).

    If you choose varchar as user_id (based on md5 encryption), just convert the integer value to md5. If you choose integer as user_id, just replace all old user_id to auto increment integer. Btw, whatever you choose, I suggest you to create a php script to run your table convertion / joining. Please remember to make sure that username / email are unique.
     
    khajeya, Aug 5, 2009 IP
  5. web@master24

    web@master24 Active Member

    Messages:
    418
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    90
    #5
    Ok, and the password, the password too is in MD5 encryption, so how i can change and the other script detect the same password
     
    web@master24, Aug 5, 2009 IP
  6. khajeya

    khajeya Member

    Messages:
    256
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #6
    if in old table use md5 too, just insert the current values to new table. but if no encrypted, just create the encypt version in your php before import to new table. if it use another encryption, you must find way to decript it first :D
     
    khajeya, Aug 5, 2009 IP