· 8 years ago · Jul 11, 2018, 09:28 PM
1<?php
2//Created by Cooldude170
3while (1) {
4 function installDB()
5 {
6 echo "What is the DB host?\n";
7 $host = trim(fgets(STDIN));
8 echo "What is the DB username?\n";
9 $user = trim(fgets(STDIN));
10 echo "What is the DB password?\n";
11 $pass = trim(fgets(STDIN));
12 echo "What is the DB name?\n";
13 $name = trim(fgets(STDIN));
14 mysql_connect($host, $user, $pass) or die(mysql_error());
15 mysql_select_db($name) or die(mysql_error());
16 echo "Successfully established MySQL connection to database " . $name . " on host " . $host . "!\n";
17 echo "Uploading the tables to the database, please wait a moment...";
18 $accs = "CREATE TABLE IF NOT EXISTS `accs` (
19 `ID` int(11) NOT NULL AUTO_INCREMENT,
20 `name` text NOT NULL COMMENT 'Nickname',
21 `crumbs` text NOT NULL COMMENT 'User Crumbs',
22 `password` text NOT NULL COMMENT 'MD5 Password',
23 PRIMARY KEY (`ID`)
24) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
25";
26 $redemption = "CREATE TABLE IF NOT EXISTS `redemption` (
27 `ID` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Index',
28 `Type` text NOT NULL COMMENT 'Type',
29 `Code` text NOT NULL,
30 `Items` text NOT NULL,
31 `Coins` int(11) NOT NULL DEFAULT '0',
32 `Expire` int(11) NOT NULL DEFAULT '0' COMMENT 'Unix expire date',
33 `Uses` int(11) NOT NULL DEFAULT '1',
34 PRIMARY KEY (`ID`)
35) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Redemption Server Data' AUTO_INCREMENT=1 ;";
36 $stats = "CREATE TABLE IF NOT EXISTS `stats` (
37 `ID` int(11) NOT NULL COMMENT 'Server ID',
38 `population` int(11) NOT NULL COMMENT 'Population',
39 `ts` text NOT NULL COMMENT 'Timestamp',
40 UNIQUE KEY `ID` (`ID`)
41) ENGINE=MyISAM DEFAULT CHARSET=latin1;";
42 mysql_query($accs) or die(mysql_error());
43 mysql_query($redemption) or die(mysql_error());
44 mysql_query($stats) or die(mysql_error());
45 echo "Done. Thank you for using iCPPS Installer created by Cooldude170!\n";
46 sleep(5);
47 }
48 installDB();
49}