MageDB Development blog
Friday, 2. February 2007, 14:35:02
Development news of paFileDB Extreme Edition (EXED)
Friday, 2. February 2007, 14:35:02
Friday, 2. February 2007, 02:43:12
Sunday, 28. January 2007, 02:20:38
Monday, 22. January 2007, 21:24:39
Friday, 19. January 2007, 16:38:59
Thursday, 18. January 2007, 23:22:12
Wednesday, 17. January 2007, 22:35:16
Saturday, 13. January 2007, 00:51:48
Thursday, 11. January 2007, 18:52:56
Monday, 8. January 2007, 22:38:27
Friday, 5. January 2007, 15:44:28
Monday, 1. January 2007, 02:38:20
Friday, 29. December 2006, 22:03:16
Wednesday, 27. December 2006, 21:42:34
Monday, 25. December 2006, 00:05:06
<?php
/*=================================================================
| MySQL Backup DB 1.0 |
+-----------------------------------------------------------------+
| Backup DB is a php script that is used to make database |
| backups. With this script you can not only make a dump of |
| the table structure but also a complete dump of the entire |
| entire database. |
| |
| |
| Creator : Mark also known as markg85 |
| E-Mail : markg852@hotmail.com |
| Licence : GPL V2 |
| Version : 1.0 |
| |
=================================================================*/
require ('../db/mysql.php');
class backupdb extends padb_mysql
{
// Public Vars
var $show_charset = 'no'; // useless at this moment
var $do_table = '*.*'; // useless at this moment
// Private Vars
var $types = array(MYSQL_ASSOC, MYSQL_NUM, MYSQL_BOTH);
var $engines;
var $auto_increment;
// Constructor
function structure_dbbackup()
{
$table_names = $this->fetch_all(mysql_list_tables($this->dbname));
$this->engines = array();
$structure = '';
$table_status_array = $this->fetch_all(mysql_query("show table status from pafiledb353"));
foreach ($table_status_array as $table_status)
{
$this->engines[$table_status['Name']] = $table_status['Engine'];
$this->auto_increment[$table_status['Name']] = $table_status['Auto_increment'];
//echo $table_status['Engine'] . '<br>';
}
foreach ($table_names as $table_array)
{
foreach ($table_array as $table)
{
$structure .= '-- ' . str_repeat('-', 80) . '<br>';
$structure .= '-- ' . $table . '<br>';
$structure .= '-- ' . str_repeat('-', 80) . '<br><br>';
$structure .= 'CREATE TABLE IF NOT EXISTS `' . $table . '`<br>(<br>';
$index_query = mysql_query("SHOW INDEX FROM " . $table . " FROM pafiledb353");
$index_array = $this->fetch_all($index_query);
$num_rows = mysql_num_rows($index_query);
$columns_array = $this->fetch_all(mysql_query("SHOW COLUMNS FROM " . $table . ""));
$num_fields = mysql_num_fields(mysql_query("SELECT * FROM " . $table . ""));
foreach ($columns_array as $key => $column)
{
$structure .= str_repeat(' ', 4) . '`' . $column['Field'] . '` ' . $column['Type'];
if (empty($column['Extra']))
{
if (!preg_match('/text/i', $column['Type']))
{
$structure .= (trim($column['Default']) == '') ? '' : ' DEFAULT \'' . $column['Default'] . '\'';
}
}
$structure .= ($column['Null'] == 'NO') ? ' NOT NULL' : ' NULL';
$structure .= (!empty($column['Extra'])) ? ' ' . strtoupper($column['Extra']) : '';
$structure .= ($num_fields -1 == $key AND $num_rows == 0) ? '<br>' : ',<br>';
}
foreach ($index_array as $key => $index)
{
if ($index['Non_unique'] == 0 and $index['Index_type'] == 'BTREE')
{
$structure .= str_repeat(' ', 4) . 'PRIMARY KEY (`' . $index['Column_name'] . '`)';
}
if ($index['Non_unique'] == 1 and $index['Index_type'] == 'BTREE')
{
$structure .= str_repeat(' ', 4) . 'KEY `' . $index['Key_name'] . '` (`' . $index['Column_name'] . '`)';
}
$structure .= ($key == $num_rows - 1) ? '<br>' : ',<br>';
}
$structure .= ') ';
$structure .= 'ENGINE=' . $this->engines[$table] . ((!empty($this->auto_increment[$table])) ? ' AUTO_INCREMENT=' . $this->auto_increment[$table] : '') . ';<br><br><br>';
}
}
return $structure;
}
// This function fetches all sql data and puts it in a multidimensional array
function fetch_all($result, $type = MYSQL_ASSOC)
{
if (!in_array($type, $this->types)) die("Invalid Action!");
$all = array();
while ($row = mysql_fetch_array($result, $type))
{
$all[] = $row;
}
return $all;
}
}
$test = new backupdb;
echo $test->structure_dbbackup();
?>
-- --------------------------------------------------------------------------------
-- pafiledb_admin
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_admin`
(
`admin_id` int(5) NOT NULL AUTO_INCREMENT,
`admin_username` varchar(20) NULL,
`admin_password` varchar(32) NULL,
`admin_email` varchar(50) NULL,
`admin_status` int(1) NULL,
PRIMARY KEY (`admin_id`)
) ENGINE=MyISAM AUTO_INCREMENT=2;
-- --------------------------------------------------------------------------------
-- pafiledb_cat
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_cat`
(
`cat_id` int(5) NOT NULL AUTO_INCREMENT,
`cat_name` varchar(75) NULL,
`cat_desc` varchar(150) NULL,
`cat_files` int(10) NULL,
`cat_parent` int(5) NULL,
`cat_order` int(5) NULL,
`cat_sort` varchar(25) NULL,
PRIMARY KEY (`cat_id`)
) ENGINE=MyISAM AUTO_INCREMENT=103;
-- --------------------------------------------------------------------------------
-- pafiledb_comments
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_comments`
(
`comments_id` int(10) NOT NULL AUTO_INCREMENT,
`file_id` int(10) DEFAULT '0' NOT NULL,
`news_id` int(10) DEFAULT '0' NOT NULL,
`comments_text` text NOT NULL,
`comments_poster` text NOT NULL,
`comments_ip` text NOT NULL,
`comments_title` text NOT NULL,
`comments_time` int(50) DEFAULT '0' NOT NULL,
`show_comment` int(2) DEFAULT '1',
`comments_warning` int(2) DEFAULT '0' NULL,
PRIMARY KEY (`comments_id`)
) ENGINE=MyISAM AUTO_INCREMENT=4;
-- --------------------------------------------------------------------------------
-- pafiledb_custom
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_custom`
(
`custom_id` int(5) NOT NULL AUTO_INCREMENT,
`custom_name` varchar(50) NOT NULL,
`custom_description` varchar(150) NOT NULL,
PRIMARY KEY (`custom_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------------------------------
-- pafiledb_customdata
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_customdata`
(
`customdata_file` int(5) DEFAULT '0' NOT NULL,
`customdata_custom` int(5) DEFAULT '0' NOT NULL,
`data` text NOT NULL
) ENGINE=MyISAM;
-- --------------------------------------------------------------------------------
-- pafiledb_emaillog
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_emaillog`
(
`e_id` int(6) NOT NULL AUTO_INCREMENT,
`e_date` int(20) DEFAULT '0' NOT NULL,
`e_ip` varchar(15) NOT NULL,
`e_fromname` text NOT NULL,
`e_fromaddress` text NOT NULL,
`e_toname` text NOT NULL,
`e_toaddress` text NOT NULL,
`e_headers` text NOT NULL,
`e_subject` text NOT NULL,
`e_message` text NOT NULL,
PRIMARY KEY (`e_id`)
) ENGINE=MyISAM AUTO_INCREMENT=100;
-- --------------------------------------------------------------------------------
-- pafiledb_exed
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_exed`
(
`id` smallint(1) unsigned NOT NULL AUTO_INCREMENT,
`newindicator` tinyint(1) unsigned DEFAULT '1',
`displaynewindicatordays` tinyint(1) unsigned DEFAULT '5',
`downtime` tinyint(1) unsigned DEFAULT '1',
`filesize` tinyint(1) unsigned DEFAULT '1',
`filesize_type` tinyint(1) unsigned DEFAULT '1',
`filesize_intervalcheck` tinyint(1) unsigned DEFAULT '0' NOT NULL,
`filesize_interval` smallint(1) unsigned DEFAULT '1000',
`pleasewait` tinyint(1) unsigned DEFAULT '0' NOT NULL,
`waittime` tinyint(1) unsigned DEFAULT '5',
`commentskin` tinyint(1) unsigned DEFAULT '1',
`permalink` tinyint(1) unsigned DEFAULT '1',
`commentsx` tinyint(1) unsigned DEFAULT '1',
`thumbnailingx` tinyint(1) unsigned DEFAULT '1',
`enabledisablefile` tinyint(1) unsigned DEFAULT '0' NOT NULL,
`enabledisabledownload` tinyint(1) unsigned DEFAULT '0' NOT NULL,
`toplist` tinyint(1) unsigned DEFAULT '1',
`toplist_where` tinyint(1) unsigned DEFAULT '1',
`toplist_downloads` tinyint(1) unsigned DEFAULT '1',
`toplist_ratings` tinyint(1) unsigned DEFAULT '1',
`toplist_newest` tinyint(1) unsigned DEFAULT '1',
`show_drop_down` tinyint(1) unsigned DEFAULT '1',
`show_file_log` tinyint(1) unsigned DEFAULT '0' NOT NULL,
`icon_or_thumb` tinyint(1) unsigned DEFAULT '1',
`pagination_style` tinyint(1) unsigned DEFAULT '1',
`sec_xml` text NOT NULL,
`sec_last_xml_fetch` char(10) NOT NULL,
`version` varchar(10) NOT NULL,
`sec_version` text NOT NULL,
`sec_last_mail` char(10) NOT NULL,
`readable_version` varchar(15) NOT NULL,
`register_mod` tinyint(1) unsigned DEFAULT '1',
`guest_must_register` tinyint(1) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2;
-- --------------------------------------------------------------------------------
-- pafiledb_files
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_files`
(
`file_id` int(10) NOT NULL AUTO_INCREMENT,
`file_name` varchar(150) NULL,
`file_desc` varchar(200) NULL,
`file_creator` varchar(100) NULL,
`file_version` varchar(20) NULL,
`file_longdesc` text NULL,
`file_ssurl` text NULL,
`file_dlurl` text NULL,
`file_size` varchar(20) DEFAULT '0|0',
`file_mirrors` text NOT NULL,
`file_time` int(50) NULL,
`file_catid` int(5) NULL,
`file_posticon` varchar(30) NULL,
`file_license` int(5) NULL,
`file_dls` int(10) NULL,
`file_last` int(50) NULL,
`file_pin` int(1) NULL,
`file_docsurl` text NULL,
`file_rating` int(10) DEFAULT '0' NOT NULL,
`file_totalvotes` int(10) DEFAULT '0' NOT NULL,
`file_disabled` tinyint(1) unsigned DEFAULT '0' NOT NULL,
`file_download_disabled` tinyint(1) unsigned DEFAULT '0' NOT NULL,
`file_added_by` text NOT NULL,
`file_edited` text NOT NULL,
PRIMARY KEY (`file_id`),
KEY `file_dls` (`file_dls`),
KEY `file_time` (`file_time`),
KEY `file_name` (`file_name`)
) ENGINE=MyISAM AUTO_INCREMENT=254;
-- --------------------------------------------------------------------------------
-- pafiledb_filestats
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_filestats`
(
`fs_id` smallint(1) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`fs_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------------------------------
-- pafiledb_license
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_license`
(
`license_id` int(5) NOT NULL AUTO_INCREMENT,
`license_name` varchar(30) NULL,
`license_text` text NULL,
PRIMARY KEY (`license_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
-- --------------------------------------------------------------------------------
-- pafiledb_permissions
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_permissions`
(
`id` smallint(1) unsigned NOT NULL AUTO_INCREMENT,
`cat_id` text NOT NULL,
`admin_id` smallint(1) unsigned NOT NULL,
`perm_add_files` tinyint(1) unsigned NOT NULL,
`perm_edit_files` tinyint(1) unsigned NOT NULL,
`perm_del_files` tinyint(1) unsigned NOT NULL,
`perm_manage_files` tinyint(1) unsigned NOT NULL,
`perm_add_cats` tinyint(1) unsigned NOT NULL,
`perm_edit_cats` tinyint(1) unsigned NOT NULL,
`perm_del_cats` tinyint(1) unsigned NOT NULL,
`perm_add_ums` tinyint(1) unsigned NOT NULL,
`perm_edit_ums` tinyint(1) unsigned NOT NULL,
`perm_del_ums` tinyint(1) unsigned NOT NULL,
`perm_manage_ums` tinyint(1) unsigned NOT NULL,
`perm_create_db_backup` tinyint(1) unsigned NOT NULL,
`perm_edit_pafiledb_info` tinyint(1) unsigned NOT NULL,
`perm_enable_disable_mod` tinyint(1) unsigned NOT NULL,
`perm_change_mod_settings` tinyint(1) unsigned NOT NULL,
`perm_view_mail_log` tinyint(1) unsigned NOT NULL,
`perm_manage_licence` tinyint(1) unsigned NOT NULL,
`perm_manage_custom` tinyint(1) unsigned NOT NULL,
`perm_view_phpinfo` tinyint(1) unsigned NOT NULL,
`perm_rebuild_categorymenu` tinyint(1) unsigned NOT NULL,
`perm_versioncheck` tinyint(1) unsigned NOT NULL,
`perm_seccheck` tinyint(1) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2;
-- --------------------------------------------------------------------------------
-- pafiledb_searchquery
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_searchquery`
(
`id` smallint(1) unsigned NOT NULL AUTO_INCREMENT,
`query` varchar(50) NOT NULL,
`key` char(32) NOT NULL,
`in` varchar(20) NOT NULL,
`sort_on` varchar(20) NOT NULL,
`order` char(4) NOT NULL,
`results` varchar(10) NOT NULL,
`timeout` char(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=52;
-- --------------------------------------------------------------------------------
-- pafiledb_settings
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_settings`
(
`id` int(1) NOT NULL AUTO_INCREMENT,
`dbname` text NOT NULL,
`dburl` text NOT NULL,
`topnumber` int(5) DEFAULT '0' NOT NULL,
`homeurl` text NOT NULL,
`timeoffset` int(5) DEFAULT '0' NOT NULL,
`timezone` varchar(100) NOT NULL,
`skin` varchar(20) NOT NULL,
`stats` int(1) DEFAULT '0' NOT NULL,
`lang` varchar(20) NOT NULL,
`viewall` int(1) DEFAULT '0' NOT NULL,
`showss` int(1) DEFAULT '0' NOT NULL,
`date_format` varchar(40) NOT NULL,
`time_format` varchar(40) NOT NULL,
`dropdown` text NOT NULL,
`enable_email` int(1) DEFAULT '0' NOT NULL,
`perpage` int(3) DEFAULT '0' NOT NULL,
`enable_report` int(1) DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2;
-- --------------------------------------------------------------------------------
-- pafiledb_users
-- --------------------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `pafiledb_users`
(
`user_id` mediumint(1) unsigned NOT NULL AUTO_INCREMENT,
`user_username` varchar(25) NOT NULL,
`user_password` varchar(32) NOT NULL,
`user_mail` varchar(50) NOT NULL,
`user_permission` mediumint(1) unsigned NOT NULL,
PRIMARY KEY (`user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
Sunday, 24. December 2006, 14:54:49
Friday, 15. December 2006, 20:53:39
Thursday, 14. December 2006, 22:05:10


Sunday, 10. December 2006, 20:50:39
Wednesday, 29. November 2006, 20:23:49
Tuesday, 28. November 2006, 01:13:39

Sunday, 26. November 2006, 15:09:18
Friday, 24. November 2006, 13:57:32
Tuesday, 21. November 2006, 22:05:57
Sunday, 19. November 2006, 19:26:02
Saturday, 18. November 2006, 00:26:43
Monday, 13. November 2006, 16:40:25
Monday, 16. October 2006, 00:54:58
Thursday, 28. September 2006, 19:22:35
Wednesday, 20. September 2006, 12:57:31
Monday, 18. September 2006, 00:27:39
Wednesday, 13. September 2006, 19:24:06

Sunday, 10. September 2006, 18:37:28
Wednesday, 30. August 2006, 19:36:10
Thursday, 10. August 2006, 21:36:20
Wednesday, 9. August 2006, 22:40:34
Sunday, 6. August 2006, 23:03:58
Saturday, 5. August 2006, 16:08:22
Tuesday, 11. July 2006, 13:49:37
Friday, 7. July 2006, 13:02:50
Saturday, 1. July 2006, 15:01:15

Sunday, 25. June 2006, 22:24:07
Saturday, 24. June 2006, 20:47:54
Friday, 23. June 2006, 12:25:04
Thursday, 22. June 2006, 20:23:34
Thursday, 22. June 2006, 09:49:04
Wednesday, 21. June 2006, 22:02:23
Friday, 16. June 2006, 20:11:34
Wednesday, 14. June 2006, 12:04:40
Monday, 12. June 2006, 23:48:00
Showing posts 1 - 50 of 51.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
| ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | ||