<?php
/* Install Promo system tables */

include('../init.php');

/* Create Promo Tables */

$osDB->query("CREATE TABLE ".DB_PREFIX.
	"_promo (
  `id` int(11) NOT NULL auto_increment,
  `promocode` varchar(10) NOT NULL,
  `pdesc` varchar(50) NOT NULL,
  `promotype` varchar(20) NOT NULL,
  `memberlevel` int(1) NOT NULL,
  `increasedays` int(3) NOT NULL,
  `active` int(1) NOT NULL,
  PRIMARY KEY  (`id`)
)");

$osDB->query("CREATE TABLE ".DB_PREFIX."_promo_used (
  `id` int(11) NOT NULL auto_increment,
  `userid` int(11) NOT NULL,
  `promocode` varchar(10) NOT NULL,
  `used_date` date ,
  PRIMARY KEY  (`id`)
) ");

/* Now manage admin permissions table */
$osDB->query("alter table ".DB_PREFIX."_admin_permissions add
(promo_mgt    char(1))");

$osDB->query("update ".DB_PREFIX."_admin_permissions set promo_mgt=1 where adminid=1");
?>