Advertisement
sagnik

create_tables(sgp).php

Jan 2nd, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $sgpMsgs1 = array();
  3. $errStyle = "<div class=\"error\">";
  4. $okStyle = "<div class=\"success\">";
  5.  
  6. mysql_select_db("sgs_sgpaste", $connect);
  7. $features_table = "CREATE TABLE `sgs_sgpaste`.`features`(`id` INT(12) AUTO_INCREMENT NOT NULL, `plan` VARCHAR(24) NOT NULL, `name` VARCHAR(62) NOT NULL, `paste` BLOB NOT NULL, `paste_limit` VARCHAR(9) NOT NULL, `syntax` VARCHAR NOT NULL, `upload` BLOB NOT NULL, `delete` BLOB NOT NULL, `edit` BLOB NOT NULL, `mlimit` VARCHAR(9) NOT NULL, `badge` BLOB NOT NULL, `acfees` INT(1) NOT NULL, `mfees` INT(2) NOT NULL, `yfees` INT(3) NOT NULL, `uprice` INT(2) NOT NULL, `signup` BLOB NOT NULL, `signup_time` VARCHAR(8) NOT NULL, `signup_date` VARCHAR(10) NOT NULL, PRIMARY_KEY(id))
  8. ENGINE=MyISAM, CHARACTER_SET=utf8";
  9.  
  10. $features_entry = "INSERT INTO `features`(`id`, `plan`) VALUES(1, 'free'), (2, 'premium'), (3, 'super')";
  11.  
  12. $q1 = mysql_query($features_table);
  13. $q2 = mysql_query($features_entry);
  14.  
  15.  
  16. if (!$q1) {
  17. $sgpMsgs1[] = $errStyle."Unable to create 'sgp_features' table: [Error #". mysql_errno($connect)."]". mysql_error($connect)."</div>";
  18. } else {
  19. $sgpMsgs1[] = $okStyle."Table 'sgp_features' table was created successfully</div>";
  20. }
  21.  
  22. if (!$q2) {
  23. $sgpMsgs1[] = $errStyle."Unable to create SGPaste Plans: [Error #".mysql_errno($connect)."]". mysql_error($connect)."</div>";
  24. } else {
  25. $sgpMsgs1[] = $okStyle."SGPaste Plans was created successfully.</div>";
  26. }
  27.  
  28.  
  29.  
  30. if (!empty($sgpMsgs1)) {
  31. foreach ($sgpMsgs1 as $sgpMsg1) {
  32. echo "<li>".$sgpMsg1."</li>";
  33. }
  34. }
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement