Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo 'The config setup is for Kitsune AS2 only!';
- //config starts.
- $answers = array(
- 'yes'
- );
- $no = array(
- 'no'
- );
- echo "Enter Database Host: ";
- $dbhost = ' ';
- echo "Enter Database Username: ";
- $dbUser = ' ';
- echo "Enter Database Password: ";
- $dbPass = ' ';
- echo "Enter Database Name: ";
- $dbName = ' ';
- if ($dbPass == "") {
- echo "Without db pass? Omg, please setup a password for your db.";
- }
- if ($dbName == "") {
- echo "Um, please provide a database for the script.";
- }
- if (strlen($dbPass) < 5) {
- echo "Um, please use a strong password.";
- }
- $con = mysqli_connect($dbHost, $dbUser, $dbPass, $dbName);
- $conan = ' ';
- if (!con) {
- echo "Oops! We couldn't connect to the database..\n";
- } else {
- $xml = new DOMDocument('1.0', 'utf-8');
- $xml->formatOutput = true;
- $xml->preserveWhiteSpace = false;
- $xml->load('Database.xml');
- $element = $xml->getElementsByTagName('Database');
- $address = $element->getElementsByTagName('address');
- $username = $element->getElementsByTagName('username');
- $password = $element->getElementsByTagName('password');
- $name = $element->getElementsByTagName('name');
- $element->replaceChild($address, $dbhost);
- $element->replaceChild($username, $dbUser);
- $element->replaceChild($password, $dbPass);
- $element->replaceChild($name, $dbName);
- }
- if (in_array($conan, $answers)) {
- $xml = new DOMDocument('1.0', 'utf-8');
- $xml->formatOutput = true;
- $xml->preserveWhiteSpace = false;
- $xml->load('Database.xml');
- $element = $xml->getElementsByTagName('Database');
- $address = $element->getElementsByTagName('address');
- $username = $element->getElementsByTagName('username');
- $password = $element->getElementsByTagName('password');
- $name = $element->getElementsByTagName('name');
- $element->replaceChild($address, $dbhost);
- $element->replaceChild($username, $dbUser);
- $element->replaceChild($password, $dbPass);
- $element->replaceChild($name, $dbName);
- }
- if (in_array($conan, $no)) {
- die("Shutting down configuration...");
- }
- if ($con) {
- echo "Almost done!\n";
- echo "Would you like us to setup the database?";
- $answer = ' ';
- mysqli_query('CREATE DATABASE IF NOT EXISTS ' . $dbName . '') or die(mysqli_error());
- mysqli_query('USE ' . $dbName . '');
- mysqli_query("CREATE TABLE IF NOT EXISTS `bans` (
- `ID` int(11) NOT NULL AUTO_INCREMENT,
- `Moderator` char(12) NOT NULL,
- `Player` int(11) unsigned NOT NULL,
- `Comment` text NOT NULL,
- `Expiration` int(8) NOT NULL,
- `Time` int(8) NOT NULL,
- `Type` smallint(3) unsigned NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;") or die(mysqli_error());
- mysqli_query("CREATE TABLE IF NOT EXISTS `igloos` (
- `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `Owner` int(10) unsigned NOT NULL,
- `Type` tinyint(3) unsigned NOT NULL DEFAULT '1',
- `Floor` tinyint(3) unsigned NOT NULL DEFAULT '0',
- `Music` smallint(6) NOT NULL DEFAULT '0',
- `Furniture` text NOT NULL,
- `Locked` tinyint(1) NOT NULL DEFAULT '1'
- ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1") or die(mysqli_error());
- mysqli_query("CREATE TABLE IF NOT EXISTS `penguins` (
- `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `Username` char(12) NOT NULL,
- `Nickname` char(16) NOT NULL,
- `Password` char(32) NOT NULL,
- `LoginKey` char(32) NOT NULL,
- `Email` char(254) NOT NULL,
- `RegistrationDate` int(8) NOT NULL,
- `Moderator` tinyint(1) NOT NULL DEFAULT '0',
- `Inventory` text NOT NULL,
- `Coins` mediumint(7) unsigned NOT NULL DEFAULT '500',
- `Igloo` int(10) unsigned NOT NULL COMMENT 'Current active igloo',
- `Igloos` text NOT NULL COMMENT 'Owned igloo types',
- `Furniture` text NOT NULL COMMENT 'Furniture inventory',
- `Color` tinyint(3) unsigned NOT NULL DEFAULT '1',
- `Head` smallint(5) unsigned NOT NULL DEFAULT '0',
- `Face` smallint(5) unsigned NOT NULL DEFAULT '0',
- `Neck` smallint(5) unsigned NOT NULL DEFAULT '0',
- `Body` smallint(5) unsigned NOT NULL DEFAULT '0',
- `Hand` smallint(5) unsigned NOT NULL DEFAULT '0',
- `Feet` smallint(5) unsigned NOT NULL DEFAULT '0',
- `Photo` smallint(5) unsigned NOT NULL DEFAULT '0',
- `Flag` smallint(5) unsigned NOT NULL DEFAULT '0',
- `Walking` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Puffle ID',
- `Banned` varchar(20) NOT NULL DEFAULT '0' COMMENT 'Timestamp of ban',
- `Stamps` text NOT NULL,
- `StampBook` varchar(150) NOT NULL DEFAULT '1%1%-1%1',
- `EPF` varchar(9) NOT NULL DEFAULT '0,0,0',
- `Buddies` text NOT NULL,
- `Ignores` text NOT NULL,
- `MinutesPlayed` int(11) NOT NULL
- ) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;") or die(mysqli_error());
- mysqli_query("CREATE TABLE IF NOT EXISTS `postcards` (
- `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `Recipient` int(10) unsigned NOT NULL,
- `SenderName` char(12) NOT NULL,
- `SenderID` int(10) unsigned NOT NULL,
- `Details` varchar(12) NOT NULL,
- `Date` int(8) NOT NULL,
- `Type` smallint(5) unsigned NOT NULL,
- `HasRead` tinyint(1) NOT NULL DEFAULT '0'
- ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;") or die(mysqli_error());
- mysqli_query("CREATE TABLE IF NOT EXISTS `puffles` (
- `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `Owner` int(10) unsigned NOT NULL,
- `Name` char(12) NOT NULL,
- `AdoptionDate` int(8) NOT NULL,
- `Type` tinyint(3) unsigned NOT NULL,
- `Food` tinyint(3) unsigned NOT NULL DEFAULT '100',
- `Play` tinyint(3) unsigned NOT NULL DEFAULT '100',
- `Rest` tinyint(3) unsigned NOT NULL DEFAULT '100',
- `Walking` int(11) NOT NULL
- ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;") or die(mysqli_error());
- mysqli_query("INSERT INTO `puffles` (`ID`, `Owner`, `Name`, `AdoptionDate`, `Type`, `Food`, `Play`, `Rest`, `Walking`) VALUES
- (3, 101, 'Blue', 1453750614, 0, 100, 100, 100, 0),
- (4, 101, 'Blue', 1453752421, 0, 100, 100, 100, 0),
- (5, 101, 'Red', 1453753127, 5, 100, 100, 100, 1),
- (6, 101, 'Yellow', 1453753887, 6, 100, 100, 100, 0),
- (7, 101, 'Pink', 1453829330, 1, 100, 100, 100, 0),
- (8, 101, 'Purple', 1454159945, 4, 100, 100, 100, 0);") or die(mysqli_error());
- echo "The database is now setup!";
- } else {
- die("The configuration file has been written, but we were not able to give you\n the option of setting up your database because the connection failed!");
- }
- ?>
Add Comment
Please, Sign In to add comment