📜 ⬆️ ⬇️

Distributed File Storage Network on Gmail.com

Everyone has long been aware of the great mail gmail.com and the ability to store more than 7 gigabytes of mail there. I think that everyone also knows about such plugins as GMail Drive, which allows you to store files in your account. But, now the conversation is not about that, I want to tell you about a really working system that allows you to store an unlimited number of files on Gmail.com distributed and redundantly. So, the task that I needed to solve three years ago, where to store an ever-increasing archive of files, many of which I will not use for a long time, because I am skeptical about paid services, it was decided to make it free. The choice fell on gmail.com, which even then provided enough space to store mail.

But, it was necessary to solve the following tasks
  1. the size of the letter gmail.com three years ago was 10 megabytes
  2. if you upload more than 600 megabytes to the mail in a short period, the mail will be blocked
  3. if you unload more than 600 megabytes from the mail in a short period, the mail is also blocked
The solution came by itself, 100 mail accounts were created, and a storage system was written.

The system consists of the following parts:
')
1. File upload to the system

Here the solution came by itself, since gmail.com does not allow storing more than 10 megabytes, the file is divided into chunks and loaded in parts. In MySQL, tables were created (see the appendix at the bottom of the post) added accounts and a download script was written to gmail.

2. Providing redundancy

For this, a script was created that defined how many places each chunk is stored, if there are less than 2x of such places (for example, an account was blocked or just a new file, then the script migrated the chunk to another account)

3. File Download

To download a file, a random image was selected to have an account that stores each chunk and was sequentially loaded into the system.

4. Verification of accounts.

A special script periodically checked accounts for account lockout and saved this information in the database.

5. Booting from other servers

Especially in order not to produce a lot of logins, a central server was created that logged into accounts and saved cookies. With the help of a special protocol, the other servers could request cookies and immediately start downloading the file bypassing the login stage.

Thus, a system was created that allows you to store an almost unlimited number of files and provides a distributed download network.

Account table
Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  1. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  2. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  3. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  4. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  5. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  6. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  7. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  8. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  9. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  10. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  11. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  12. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  13. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  14. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  15. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  16. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  17. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  18. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  19. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  20. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )
  21. Copy Source | Copy HTML CREATE TABLE IF NOT EXISTS `account` ( `ACCOUNT_ID` int (11) NOT NULL auto_increment, `ACCOUNT_LOGIN` varchar (32) NOT NULL default '' , `ACCOUNT_PASSWORD` varchar (32) NOT NULL default '' , `ACCOUNT_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_MAX_SIZE` int (11) NOT NULL default '0' , `ACCOUNT_UPLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_DOWNLOAD_ENABLED` tinyint(4) NOT NULL default '0' , `ACCOUNT_BANNED` tinyint(4) NOT NULL default '0' , `ACCOUNT_ERRORS` int (11) NOT NULL default '0' , `ACCOUNT_INVITES` int (11) NOT NULL default '0' , `ACCOUNT_UPDATE_DATETIME` datetime default NULL , PRIMARY KEY (`ACCOUNT_ID`), UNIQUE KEY `ACCOUNT_LOGIN` (`ACCOUNT_LOGIN`), KEY `ACCOUNT_SIZE` (`ACCOUNT_SIZE`), KEY `ACCOUNT_DOWNLOAD_ENABLED` (`ACCOUNT_DOWNLOAD_ENABLED`), KEY `ACCOUNT_BANNED` (`ACCOUNT_BANNED`), KEY `ACCOUNT_ERRORS` (`ACCOUNT_ERRORS`), KEY `ACCOUNT_INVITES` (`ACCOUNT_INVITES`), KEY `ACCOUNT_UPDATE_DATETIME` (`ACCOUNT_UPDATE_DATETIME`) )

File table
Copy Source | Copy HTML
  1. CREATE TABLE IF NOT EXISTS ` file` (
  2. `FILE_ID` int (11) NOT NULL auto_increment,
  3. `FILE_NAME` varchar (255) NOT NULL default '' ,
  4. `FILE_SIZE` int (10) unsigned NOT NULL default '0' ,
  5. `FILE_MD5` varchar (32) default NULL ,
  6. `FILE_DOWNLOAD_REQUEST_COUNT` int (10) unsigned NOT NULL default '0' ,
  7. `FILE_DAMAGED` tinyint (4) NOT NULL default '0' ,
  8. `FILE_NONREMOVABLE` tinyint (4) NOT NULL default '0' ,
  9. `FILE_ACCESS_DATETIME` datetime default NULL ,
  10. `FILE_DOWNLOAD_RATE` float NOT NULL default '0' ,
  11. PRIMARY KEY (`FILE_ID`),
  12. KEY `FILE_SIZE` (` FILE_SIZE`),
  13. KEY `FILE_DOWNLOAD_COUNT` (` FILE_DOWNLOAD_REQUEST_COUNT`),
  14. KEY `FILE_NONREMOVABLE` (` FILE_NONREMOVABLE`),
  15. KEY `FILE_ACCESS_DATETIME` (` FILE_ACCESS_DATETIME`),
  16. KEY `FILE_DOWNLOAD_RATE` (` FILE_DOWNLOAD_RATE`),
  17. KEY `FILE_MD5` (` FILE_MD5`),
  18. KEY `FILE_DAMAGED` (` FILE_DAMAGED`, `FILE_NONREMOVABLE`)
  19. )

Chunks table
Copy Source | Copy HTML
  1. CREATE TABLE IF NOT EXISTS `file_chunk` (
  2. `FILE_CHUNK_ID` int (11) NOT NULL auto_increment,
  3. `FILE_ID` int (11) NOT NULL default '0' ,
  4. `FILE_CHUNK_OFFSET` int (11) NOT NULL default '0' ,
  5. `FILE_CHUNK_SIZE` int (11) NOT NULL default '0' ,
  6. `ACCOUNT_ID` int (11) NOT NULL default '0' ,
  7. `FILE_THREAD_ID` varchar (16) NOT NULL default '0' ,
  8. `FILE_ATTACH_ID` decimal (2.1) NOT NULL default '0.0' ,
  9. PRIMARY KEY (`FILE_CHUNK_ID`),
  10. UNIQUE KEY `ACCOUNT_ID` (` ACCOUNT_ID`, `FILE_THREAD_ID`,` FILE_ATTACH_ID`),
  11. KEY `FILE_ID` (` FILE_ID`, `FILE_CHUNK_OFFSET`)
  12. )

Source: https://habr.com/ru/post/66952/


All Articles