<?php
define('_IN_JOHNCMS', 1);
/***********
 МаГазин для сайта
 Аффтар - ValekS
 http://john-help.ru
***********/
require_once ("../incfiles/core.php");
require_once ("../incfiles/head.php");
echo '<div class="phdr">Установка Магазина Сайта</div>';

if ($user_id && $rights == 9) { 
switch ($act) {
case 'install': 
mysql_query("DROP TABLE `shop`");
mysql_query("CREATE TABLE IF NOT EXISTS `shop` (
  `id` int(3) NOT NULL auto_increment,
  `price` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE = MyISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT = 1;");

//mysql_query("ALTER TABLE `users` ADD `balans` int(11) NOT NULL default '0'");
mysql_query("ALTER TABLE `users` ADD `money_time` int(11) NOT NULL DEFAULT '0'");
mysql_query("ALTER TABLE `users` ADD `cnick` varchar(25) NOT NULL DEFAULT '0'");
mysql_query("ALTER TABLE `users` ADD `cstat` varchar(25) NOT NULL DEFAULT '0'");

mysql_query("INSERT INTO `shop` SET `price` = '10'");
mysql_query("INSERT INTO `shop` SET `price` = '20'");
mysql_query("INSERT INTO `shop` SET `price` = '30'");
mysql_query("INSERT INTO `shop` SET `price` = '40'");

mysql_query("INSERT INTO `shop` SET `price` = '20'");
mysql_query("INSERT INTO `shop` SET `price` = '15'");
mysql_query("INSERT INTO `shop` SET `price` = '15'");
mysql_query("INSERT INTO `shop` SET `price` = '10'");
mysql_query("INSERT INTO `shop` SET `price` = '5'");

mysql_query("INSERT INTO `shop` SET `price` = '20'");
mysql_query("INSERT INTO `shop` SET `price` = '10'");
mysql_query("INSERT INTO `shop` SET `price` = '10'");

mysql_query("INSERT INTO `shop` SET `price` = '30'");

echo '<div class="gmenu">Таблицы успешно созданы!</div>';
             break;
default:
echo '<div class="list1">';
include_once ('reedme.txt');
echo '</div>';
echo '<div class="list2"><a href="?act=install">Установить модуль</a> Магазин Сайта <b>v1.3.0</b> для JohnCMS 5</div>';
}
  } else {
  echo '<div class="rmenu">Недостаточно прав! Модуль можно установить только СВ!</div>';
  }
require_once ('../incfiles/end.php');


?>