Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require(__DIR__.'/globals.php');
- $tb1 = $db->num_rows($db->query("SHOW TABLES LIKE 'user_shopitems'"));
- $tb2 = $db->num_rows($db->query("SHOW TABLES LIKE 'usershops'"));
- if($tb1 && $tb2)
- echo "<span style='color:red;font-weight:bold;font-size:10px;'>Installer has detected that you have both installer files.</span>";
- else if($tb1 && !$tb2)
- echo "<span style='color:red;font-weight:bold;font-size:10px;'>Intaller detected that you already have a table called shopitems</span>";
- else if(!$tb1 && $tb2)
- echo "<span style='color:red;font-weight:bold;font-size:10px;'>Installer detected that you already have a table called usershops</span>";
- else
- {
- echo "Attempting to install first table..<br /><br />";
- $insert = $db->query("
- CREATE TABLE IF NOT EXISTS `user_shopitems` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `stype` enum('item','crystals','donatordays') NOT NULL,
- `selling` int(20) NOT NULL DEFAULT '0',
- `sqty` int(20) NOT NULL,
- `tprice` int(20) NOT NULL,
- `sID` int(11) NOT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
- if(!$insert)
- echo "There was a issue with install.<br />".$db->error();
- else
- {
- echo "Table one installed successfully.<br />";
- echo "Attempting to install the second table..<br /><br />";
- $insert = $db->query("
- CREATE TABLE IF NOT EXISTS `usershops` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(20) NOT NULL,
- `desc` varchar(100) NOT NULL,
- `pic` varchar(120) NOT NULL DEFAULT 'images/noimg.png',
- `status` int(1) NOT NULL DEFAULT '1',
- `owner` int(11) NOT NULL DEFAULT '0',
- `cdate` int(20) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;");
- if(!$insert)
- echo "There was a issue with install.<br />".$db->error();
- else
- {
- echo "Table two installed successfully.<br /><br />";
- echo "Intall complete attempting to remove intaller..";
- unlink('./player_shops_install.php');
- $success = !file_exists('./player_shops_install.php');
- echo "<span style='color: ". ($success ? "green;'>Succeeded" : "red;'>Failed"). "</span><br />";
- echo '<meta http-equiv="refresh" content="8; url=myshop.php">';
- $h->endpage();
- exit;
- if(!$success)
- echo "
- <span style='color:red;font-weight:bold;font-size:10px;'>
- Since the auto deletion of the instaltion file failed i strongly suggest you delete it manually.
- </span>";
- }
- }
- }
- $h->endpage();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement