Advertisement
Guest User

Untitled

a guest
May 28th, 2017
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.07 KB | None | 0 0
  1. <?php
  2. /*
  3. Corp Blueprint/Req Setup.php
  4. Written by James Otis. (c) 2010
  5. Setup.php - For Creating inital tables and data sets.
  6.  
  7.  
  8. +--------------------------------------------------------------+
  9. | *********THIS PROJECT WILL REQUIRE THE FOLLOWING************ |
  10. | - MYSQL DUMP OF THE EVE DATABASE (CHECK THE FORUMS)          |
  11. | - PHP, APACHE, AND MYSQL INSTALLED ON THE SERVER             |
  12. | The complete EVE Database is not really required, however    |
  13. | for future implementations planned for this project it is    |
  14. |  recomended to download and import the entire data set.      |
  15. +--------------------------------------------------------------+
  16.  
  17. */
  18. # Required to connect to MySQL database
  19. $db_name="evedump";         #This is the eve data dump database
  20. $db_user="root";        #This is your mysql username
  21. $db_pass="Password";        #Mysql password for the user
  22. $db_host="localhost";       #your mysql host address
  23. $connection=mysql_connect($db_host,$db_user,$db_pass) or Die("Connection Settings are faulty.");
  24.  
  25. #check for eve database and essential tables
  26. Echo "Checking for Database \n";
  27. Mysql_select_db("$db_name") or die("Database may not exists or was typed incorrectly");
  28. #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.
  29. Echo "Database found, check for Essential tables.\n";
  30. $result=mysql_db_query($db_name,"SELECT * FROM invTypes LIMIT 1",$connection) or die("Table not found, has the database been imported.\n");
  31. Echo "Essential Table Exists, moving to next Table\n";
  32. $result=mysql_db_query($db_name,"SELECT * FROM invGroups LIMIT 1",$connection) or die("Table not found, has the database been imported.\n");
  33. Echo "Essential Table Exists, moving to next Table\n";
  34. $result=mysql_db_query($db_name,"SELECT * FROM invBlueprintTypes LIMIT 1",$connection) or die("Table not found, has the database been imported.\n");
  35. Echo "Essential Table Exists, moving to next Table\n";
  36. $result=mysql_db_query($db_name,"SELECT * FROM ramTypeRequirements LIMIT 1",$connection) or die("Table not found, has the database been imported.\n");
  37.  
  38. # Begins the SQL Table Creation for Corp Owned BPOs to be put in.
  39. #If the corpOwnership Tables does not exists in the database this code will create it.
  40. $Create_Query = "CREATE TABLE IF NOT EXISTS corpOwnership(
  41.     `blueprint_id` INT(10) NOT NULL COMMENT 'blueprint id that is owned by the corp/player',
  42.     `owned` ENUM('Y','N') NOT NULL DEFAULT 'N' COMMENT 'is the blueprint owned',
  43.     `corp_id` INT(10) NOT NULL AUTO_INCREMENT COMMENT 'corpid',
  44.     `mineral_level` INT(10) NOT NULL DEFAULT '0' COMMENT 'the material level of the BPO',
  45.     `production_level` INT(10) NOT NULL DEFAULT '0' COMMENT 'the productivity level of the BPO',
  46.     PRIMARY KEY (`corp_id`)
  47. )
  48. COMMENT='corporate ownership of bluprints to be expanded into player '
  49. COLLATE=latin1_swedish_ci
  50. ENGINE=MyISAM
  51. ROW_FORMAT=DEFAULT";
  52.  
  53. $results = mysql_query($Create_Query)
  54.     or die(mysql_error());
  55. Echo "Corp Ownership Table Creation was successfull.\n";
  56.  
  57. /*
  58.  * This next line is a passthru to the command line inorder to import some of the more complicated table creations, this .sql file will
  59.  * drop any table named `typesBuildReqs and Rebuild it according to the new information in the database. it will also create a new view based
  60.  * 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.
  61.  */
  62. echo "Importing .sql file for the more complicated tables and views\n";
  63. passthru("mysql -u$db_user -p$db_pass $db_name < buildtables.sql");
  64.  
  65. /*
  66.  *This Section of code will build the ACL, or Access Control List for users,
  67.  *this will allow for the assignment of roles, for example only certain roles
  68.  *are allowed to mark a req as "in progress" or "completed". Even restrict
  69.  *certain user groups from placing a req.
  70.  */
  71.  
  72. $Create_Query="CREATE TABLE IF NOT EXISTS users(
  73.     `ID` INT(10) NOT NULL AUTO_INCREMENT,
  74.     `u_name` CHAR(50) NOT NULL,
  75.     `u_pass` TEXT NOT NULL,
  76.     `IG_Name` TEXT NOT NULL,
  77.     PRIMARY KEY (`ID`)
  78. )
  79. COMMENT='users table for loging in.'
  80. COLLATE=latin1_swedish_ci
  81. ENGINE=MyISAM
  82. ROW_FORMAT=DEFAULT";
  83.  
  84. $results = mysql_query($Create_Query)
  85.     or die(mysql_error());
  86. Echo "\nUsers Table Creation was successfull.\n";
  87.  
  88. $Create_Query="CREATE TABLE IF NOT EXISTS groups(
  89.     `ID` INT(10) NULL AUTO_INCREMENT,
  90.     `u_id` INT(10) NULL DEFAULT '0',
  91.     `p_id` INT(10) NULL DEFAULT '0',
  92.     PRIMARY KEY (`ID`)
  93. )
  94. COMMENT='groups for users access lists'
  95. COLLATE=latin1_swedish_ci
  96. ENGINE=MyISAM
  97. ROW_FORMAT=DEFAULT";
  98.  
  99. $results = mysql_query($Create_Query)
  100.     or die(mysql_error());
  101. Echo "Groups Table Creation was successfull.\n";
  102.  
  103. $Create_Query="CREATE TABLE IF NOT EXISTS programs (
  104.     `id` INT(10) NULL AUTO_INCREMENT,
  105.     `p_id` INT(10) NOT NULL DEFAULT '0',
  106.     `p_name` TEXT NOT NULL,
  107.     `path` MEDIUMTEXT NOT NULL,
  108.     PRIMARY KEY (`id`)
  109. )
  110. COMMENT='programs users can run'
  111. COLLATE=latin1_swedish_ci
  112. ENGINE=MyISAM
  113. ROW_FORMAT=DEFAULT";
  114.  
  115. $results = mysql_query($Create_Query)
  116.     or die(mysql_error());
  117. Echo "Programs Table Creation was successfull.\n";
  118.  
  119. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement