Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Corp Blueprint/Req Setup.php
- Written by James Otis. (c) 2010
- Setup.php - For Creating inital tables and data sets.
- +--------------------------------------------------------------+
- | *********THIS PROJECT WILL REQUIRE THE FOLLOWING************ |
- | - MYSQL DUMP OF THE EVE DATABASE (CHECK THE FORUMS) |
- | - PHP, APACHE, AND MYSQL INSTALLED ON THE SERVER |
- | The complete EVE Database is not really required, however |
- | for future implementations planned for this project it is |
- | recomended to download and import the entire data set. |
- +--------------------------------------------------------------+
- */
- # Required to connect to MySQL database
- $db_name="evedump"; #This is the eve data dump database
- $db_user="root"; #This is your mysql username
- $db_pass="Password"; #Mysql password for the user
- $db_host="localhost"; #your mysql host address
- $connection=mysql_connect($db_host,$db_user,$db_pass) or Die("Connection Settings are faulty.");
- #check for eve database and essential tables
- Echo "Checking for Database \n";
- Mysql_select_db("$db_name") or die("Database may not exists or was typed incorrectly");
- #This is not verifying data in the tables just merely checking that there is a table and at least one row in these required tables.
- Echo "Database found, check for Essential tables.\n";
- $result=mysql_db_query($db_name,"SELECT * FROM invTypes LIMIT 1",$connection) or die("Table not found, has the database been imported.\n");
- Echo "Essential Table Exists, moving to next Table\n";
- $result=mysql_db_query($db_name,"SELECT * FROM invGroups LIMIT 1",$connection) or die("Table not found, has the database been imported.\n");
- Echo "Essential Table Exists, moving to next Table\n";
- $result=mysql_db_query($db_name,"SELECT * FROM invBlueprintTypes LIMIT 1",$connection) or die("Table not found, has the database been imported.\n");
- Echo "Essential Table Exists, moving to next Table\n";
- $result=mysql_db_query($db_name,"SELECT * FROM ramTypeRequirements LIMIT 1",$connection) or die("Table not found, has the database been imported.\n");
- # Begins the SQL Table Creation for Corp Owned BPOs to be put in.
- #If the corpOwnership Tables does not exists in the database this code will create it.
- $Create_Query = "CREATE TABLE IF NOT EXISTS corpOwnership(
- `blueprint_id` INT(10) NOT NULL COMMENT 'blueprint id that is owned by the corp/player',
- `owned` ENUM('Y','N') NOT NULL DEFAULT 'N' COMMENT 'is the blueprint owned',
- `corp_id` INT(10) NOT NULL AUTO_INCREMENT COMMENT 'corpid',
- `mineral_level` INT(10) NOT NULL DEFAULT '0' COMMENT 'the material level of the BPO',
- `production_level` INT(10) NOT NULL DEFAULT '0' COMMENT 'the productivity level of the BPO',
- PRIMARY KEY (`corp_id`)
- )
- COMMENT='corporate ownership of bluprints to be expanded into player '
- COLLATE=latin1_swedish_ci
- ENGINE=MyISAM
- ROW_FORMAT=DEFAULT";
- $results = mysql_query($Create_Query)
- or die(mysql_error());
- Echo "Corp Ownership Table Creation was successfull.\n";
- /*
- * This next line is a passthru to the command line inorder to import some of the more complicated table creations, this .sql file will
- * drop any table named `typesBuildReqs and Rebuild it according to the new information in the database. it will also create a new view based
- * on other information from other tables, but no data is changed. If the view already exists it will not be duplicated, Mysql will throw a warning but setup will continue.
- */
- echo "Importing .sql file for the more complicated tables and views\n";
- passthru("mysql -u$db_user -p$db_pass $db_name < buildtables.sql");
- /*
- *This Section of code will build the ACL, or Access Control List for users,
- *this will allow for the assignment of roles, for example only certain roles
- *are allowed to mark a req as "in progress" or "completed". Even restrict
- *certain user groups from placing a req.
- */
- $Create_Query="CREATE TABLE IF NOT EXISTS users(
- `ID` INT(10) NOT NULL AUTO_INCREMENT,
- `u_name` CHAR(50) NOT NULL,
- `u_pass` TEXT NOT NULL,
- `IG_Name` TEXT NOT NULL,
- PRIMARY KEY (`ID`)
- )
- COMMENT='users table for loging in.'
- COLLATE=latin1_swedish_ci
- ENGINE=MyISAM
- ROW_FORMAT=DEFAULT";
- $results = mysql_query($Create_Query)
- or die(mysql_error());
- Echo "\nUsers Table Creation was successfull.\n";
- $Create_Query="CREATE TABLE IF NOT EXISTS groups(
- `ID` INT(10) NULL AUTO_INCREMENT,
- `u_id` INT(10) NULL DEFAULT '0',
- `p_id` INT(10) NULL DEFAULT '0',
- PRIMARY KEY (`ID`)
- )
- COMMENT='groups for users access lists'
- COLLATE=latin1_swedish_ci
- ENGINE=MyISAM
- ROW_FORMAT=DEFAULT";
- $results = mysql_query($Create_Query)
- or die(mysql_error());
- Echo "Groups Table Creation was successfull.\n";
- $Create_Query="CREATE TABLE IF NOT EXISTS programs (
- `id` INT(10) NULL AUTO_INCREMENT,
- `p_id` INT(10) NOT NULL DEFAULT '0',
- `p_name` TEXT NOT NULL,
- `path` MEDIUMTEXT NOT NULL,
- PRIMARY KEY (`id`)
- )
- COMMENT='programs users can run'
- COLLATE=latin1_swedish_ci
- ENGINE=MyISAM
- ROW_FORMAT=DEFAULT";
- $results = mysql_query($Create_Query)
- or die(mysql_error());
- Echo "Programs Table Creation was successfull.\n";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement