ok here is some ideas to do it. I have done it. But i don’t use phpizabi any more. I have developed my own script. And i had transferred the users, contacts, user gallery to my new script using this method so it can be used by you to convert the phpizabi contact, gallery system to database based.
Below is how databse structure will be like for contact and gallery system:
CREATE TABLE IF NOT EXISTS `phpizabi_contact` (
`id` int(9) NOT NULL auto_increment,
`user` int(9) NOT NULL,
`friend` int(9) NOT NULL,
`date` int(32) NOT NULL,
`is_blocked` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM ;
CREATE TABLE IF NOT EXISTS `phpizabi_contact_request` (
`id` int(9) NOT NULL auto_increment,
`for_user` int(9) NOT NULL,
`from_user` int(9) NOT NULL,
`date` int(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM ;
-- --------------------------------------------------------
--
-- Table structure for table `phpizabi_gallery`
--
CREATE TABLE IF NOT EXISTS `phpizabi_gallery` (
`id` int(11) NOT NULL auto_increment,
`user` int(10) NOT NULL default '0',
`img` varchar(100) NOT NULL default '0',
`date` int(32) NOT NULL,
`album_id` int(32) NOT NULL default '0',
`title` varchar(250) NOT NULL default '',
`description` longtext NOT NULL,
`views` int(10) NOT NULL default '0',
`comments` int(10) NOT NULL default '0',
`rating` float NOT NULL default '0',
`votes` int(11) NOT NULL default '0',
`is_mainpicture` tinyint(1) NOT NULL default '0',
PRIMARY KEY `id` (`id`),
FULLTEXT KEY `title` (`title`,`description`)
) ENGINE=MyISAM ;
CREATE TABLE IF NOT EXISTS `phpizabi_gallery_album` (
`id` int(11) NOT NULL auto_increment,
`user` int(10) NOT NULL default '0',
`date` int(64) NOT NULL default '0',
`cover_img` varchar(64) NOT NULL,
`album_name` varchar(20) NOT NULL default '',
`album_description` text NOT NULL,
PRIMARY KEY `id` (`id`),
FULLTEXT KEY `album_name` (`album_name`,`album_description`)
) ENGINE=MyISAM ;
Now to load the contents of the users from the old phpizabi database to new tables we can use the following script.
Inserting pictures to new gallery table.
$sql = myQ("SELECT `id`,`pictures`, `username` FROM `[x]users`");
while($row = myF($sql)){
$pictures = unpk($row["pictures"]);
if (!is_array($pictures)) $pictures = array();
foreach ($pictures as $pic) {
myQ("
INSERT INTO `[x]gallery` (`user`,`img`,`date`,`title`,`description`,`is_mainpicture`)
VALUES
('{$row["id"]}','{$pic["FILE"]}','".time()."','{$pic["NAME"]}','{$pic["DESCRIPTION"]}','{$pic["MAIN"]}')
");
}
}
Inserting contacts to new table:
$sql = myQ("SELECT `id`,`contacts` FROM `[x]users`");
while($row = myF($sql)){
$contacts = unpk($row["contacts"]);
if (!is_array($contacts)) $contacts = array();
foreach ($contacts as $groupName => $usersArray) {
if (is_array($usersArray)) foreach ($usersArray as $userArrayKey => $userEntity) {
myQ("
INSERT INTO `[x]contact` (`user`,`friend`,`date`)
VALUES
('{$row["id"]}','{$userEntity}','".time()."')
");
}
}
This should now transfer all the contacts and gallery pictures to the new table. I think i have covered the main part where you were confused about. After you get the informations in a table. You can code php to function with contact and gallery system. i hope it will be helpful.