-- --------------------------------------------------------

--
-- Table structure for table `tbl_access`
--

CREATE TABLE `tbl_access` (
  `access_id` int NOT NULL,
  `dt_create` timestamp NOT NULL,
  `cnts_id` int NOT NULL,
  `ipsig` varchar(100) DEFAULT NULL,
  `uagent` varchar(200) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_cfgdb`
--

CREATE TABLE `tbl_cfgdb` (
  `cfgdb_id` int NOT NULL,
  `ckey` varchar(40) DEFAULT NULL,
  `cval` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

--
-- Dumping data for table `tbl_cfgdb`
--

INSERT INTO `tbl_cfgdb` (`cfgdb_id`, `ckey`, `cval`) VALUES
(1001, 'tpl.reg.user', '{\"subject\":\"Welcome to match2cards!\",\"body\":\"Dear %first-name%,\\n\\nThank you for your registration!\\n\\nTo log into the match2cards admin panel, click the link below and enter your username and password.\\n\\nAdmin Panel URL:\\n%url-admin%\\n\\nUsername : %username%\\nPassword : %password%\\n\"}'),
(1002, 'tpl.reg.admin', '{\"subject\":\"match2cards registration\",\"body\":\"First Name:\\n%first-name%\\n\\nLast Name:\\n%last-name%\\n\\nEmail Address:\\n%email%\\n\\nType of Organization:\\n%user-type%\\n\\nPayment Options:\\n%payment-options%\\n\\nOrganization Name:\\n%organization%\\n\\nUsername:\\n%username%\\n\\nPassword:\\n%password%\\n\\nQuestions\\/Comments:\\n%comments%\\n\\nSite Creation Service:\\n%q1%\"}'),
(1003, 'tpl.trans', '{\"subject\":\"match2cards\",\"body\":\"Dear %first-name%,\\n\\nThank you for your donation!\\nHere is your ticket ID:\\n%ticket-id%\\nThe ticket ID will allow you to play %qty% turns. \\nTo play the contest, enter the ticket ID in the contest page or\\nclick the following link to open the contest page:\\n%url-contest%\\n\\n=======================================\\nContest Title: %contest-title%\\nPayPal txn_id: %txn-id%\\n=======================================\\n\"}'),
(1004, 'tpl.winning', '{\"subject\":\"You Win! [match2cards]\",\"body\":\"Dear %first-name%,\\n\\nYou Win:\\n%prize-desc%\\n\\nContest Title: %contest-title%\\nContest URL: %contest-url%\\nTicket ID: %ticket-id%\"}'),
(1005, 'tpl.send-tid', '{\"subject\":\"You\'ve got a free ticket!\",\"body\":\"Congratulations! You\'ve got a free ticket to play the match2card game, %contest-title%!\\n\\nHere is your ticket ID:\\n%ticket-id%\\n\\nThe ticket ID will allow you to play %qty% turns. \\nClick the following link to go to the game page:\\n%url-contest%\\n\"}'),
(1006, 'cfgsmtp', '{\"hostname\":\"localhost\",\"sender-email\":\"sender@mydomain.com\",\"port\":25,\"b-smtp-auth\":0,\"username\":null,\"password\":null}'),
(1007, 'cfgpaypal', '{\"pp-email\":\"paypal@mydomain.com\",\"pp-currency-code\":\"USD\",\"pp-url-thankyou\":null,\"pp-url-cancel\":null}');

-- --------------------------------------------------------

--
-- Table structure for table `tbl_cnts`
--

CREATE TABLE `tbl_cnts` (
  `cnts_id` int NOT NULL,
  `dt_create` timestamp NOT NULL,
  `user_id` int NOT NULL,
  `group_id` int NOT NULL,
  `status` tinyint NOT NULL,
  `cname` varchar(50) NOT NULL,
  `title` varchar(100) DEFAULT NULL,
  `idata` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_errlog`
--

CREATE TABLE `tbl_errlog` (
  `errlog_id` int NOT NULL,
  `dt_create` timestamp NOT NULL,
  `cnts_id` int DEFAULT NULL,
  `msg` varchar(200) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_game`
--

CREATE TABLE `tbl_game` (
  `game_id` int NOT NULL,
  `dt_create` timestamp NOT NULL,
  `cnts_id` int NOT NULL,
  `player_id` int NOT NULL,
  `cardlen` int NOT NULL,
  `hit_pos1` int NOT NULL,
  `hit_pos2` int NOT NULL,
  `prize_list` text DEFAULT NULL,
  `trans_id` int DEFAULT NULL COMMENT 'non-null after two hits',
  `dt_prize` timestamp NULL DEFAULT NULL COMMENT 'non-null after picking a prize',
  `prize_id` int DEFAULT NULL COMMENT 'non-null after picking a prize',
  `maillog_id` int DEFAULT NULL COMMENT 'non-null after sending confirmation email'
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_ipnlog`
--

CREATE TABLE `tbl_ipnlog` (
  `ipnlog_id` int NOT NULL,
  `dt_create` datetime NOT NULL,
  `mode` varchar(10) DEFAULT NULL,
  `ipaddr` varchar(15) DEFAULT NULL,
  `first_name` varchar(50) DEFAULT NULL,
  `last_name` varchar(50) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `txn_id` varchar(30) DEFAULT NULL,
  `result` varchar(100) DEFAULT NULL,
  `logtxt` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_maillog`
--

CREATE TABLE `tbl_maillog` (
  `maillog_id` int NOT NULL,
  `dt_create` datetime DEFAULT NULL,
  `sender` varchar(200) DEFAULT NULL,
  `email` varchar(200) DEFAULT NULL,
  `txt` text DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_pic`
--

CREATE TABLE `tbl_pic` (
  `pic_id` int NOT NULL,
  `dt_create` datetime NOT NULL,
  `status` tinyint NOT NULL,
  `fn` varchar(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_price`
--

CREATE TABLE `tbl_price` (
  `price_id` int NOT NULL,
  `dt_create` datetime NOT NULL,
  `cnts_id` int NOT NULL,
  `status` tinyint NOT NULL,
  `qty` int DEFAULT NULL,
  `amount` decimal(10,2) DEFAULT NULL,
  `defp` tinyint DEFAULT NULL,
  `sig` varchar(30) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_prize`
--

CREATE TABLE `tbl_prize` (
  `prize_id` int NOT NULL,
  `dt_create` timestamp NOT NULL,
  `cnts_id` int NOT NULL,
  `desc` varchar(200) DEFAULT NULL,
  `qty` int NOT NULL,
  `pic_id` int DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_sync`
--

CREATE TABLE `tbl_sync` (
  `sync_id` int NOT NULL,
  `stime` bigint NOT NULL,
  `key` varchar(100) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_tmpdb`
--

CREATE TABLE `tbl_tmpdb` (
  `tmpdb_id` int NOT NULL,
  `dt_create` timestamp NOT NULL,
  `tid` varchar(50) NOT NULL,
  `tkey` varchar(50) NOT NULL,
  `tval` text  DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_trans`
--

CREATE TABLE `tbl_trans` (
  `trans_id` int NOT NULL,
  `dt_create` datetime NOT NULL,
  `status` tinyint NOT NULL,
  `cnts_id` int NOT NULL,
  `tid` varchar(30) DEFAULT NULL,
  `player_id` int DEFAULT NULL,
  `access_token` varchar(50) DEFAULT NULL,
  `first_name` varchar(50) DEFAULT NULL,
  `last_name` varchar(50) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `txn_id` varchar(30) DEFAULT NULL,
  `mc_gross` decimal(10,2) DEFAULT NULL,
  `mc_currency` varchar(10) DEFAULT NULL,
  `qty` int DEFAULT NULL,
  `instock` int DEFAULT NULL,
  `ipnlog_id` int DEFAULT NULL,
  `maillog_id` int DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_turn`
--

CREATE TABLE `tbl_turn` (
  `turn_id` int NOT NULL,
  `dt_create` timestamp NOT NULL,
  `cnts_id` int NOT NULL,
  `game_id` int NOT NULL,
  `card_pos` int NOT NULL,
  `card_type` int NOT NULL,
  `access_id` int NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

-- --------------------------------------------------------

--
-- Table structure for table `tbl_user`
--

CREATE TABLE `tbl_user` (
  `user_id` int NOT NULL,
  `dt_create` datetime DEFAULT NULL,
  `group_id` int DEFAULT NULL,
  `status` tinyint NOT NULL,
  `b_admin` tinyint NOT NULL DEFAULT '0',
  `username` varchar(100) DEFAULT NULL,
  `passkey` varchar(300) DEFAULT NULL,
  `sess_start` datetime DEFAULT NULL,
  `sess_token` varchar(100) DEFAULT NULL,
  `first_name` varchar(50) DEFAULT NULL,
  `last_name` varchar(50) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `user_type` varchar(10) DEFAULT NULL,
  `payment_options` varchar(10) DEFAULT NULL,
  `organization` varchar(100) DEFAULT NULL,
  `comments` text DEFAULT NULL,
  `q1` varchar(10) DEFAULT NULL,
  `maillog_id_user` int DEFAULT NULL,
  `maillog_id_admin` int DEFAULT NULL,
  `ipnlog_id` int DEFAULT NULL,
  `mc_gross` decimal(10,2) DEFAULT NULL,
  `mc_currency` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

--
-- Dumping data for table `tbl_user`
--

INSERT INTO `tbl_user` (`user_id`, `dt_create`, `group_id`, `status`, `b_admin`, `username`, `passkey`, `sess_start`, `sess_token`, `first_name`, `last_name`, `email`, `user_type`, `payment_options`, `organization`, `comments`, `q1`, `maillog_id_user`, `maillog_id_admin`, `ipnlog_id`, `mc_gross`, `mc_currency`) VALUES
(1001, '2000-01-01 00:00:00', 1001, 1, 1, 'admin', 'password', NULL, NULL, 'Administrator', 'Administrator', 'admin@mydomain.com', 'indiv', '0', NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `tbl_access`
--
ALTER TABLE `tbl_access`
  ADD PRIMARY KEY (`access_id`),
  ADD KEY `dt_create` (`dt_create`),
  ADD KEY `cnts_id` (`cnts_id`),
  ADD KEY `ipsig` (`ipsig`),
  ADD KEY `uagent` (`uagent`);

--
-- Indexes for table `tbl_cfgdb`
--
ALTER TABLE `tbl_cfgdb`
  ADD PRIMARY KEY (`cfgdb_id`),
  ADD UNIQUE KEY `ckey` (`ckey`);

--
-- Indexes for table `tbl_cnts`
--
ALTER TABLE `tbl_cnts`
  ADD PRIMARY KEY (`cnts_id`),
  ADD UNIQUE KEY `cname` (`cname`),
  ADD KEY `group_id` (`group_id`),
  ADD KEY `title` (`title`);

--
-- Indexes for table `tbl_errlog`
--
ALTER TABLE `tbl_errlog`
  ADD PRIMARY KEY (`errlog_id`),
  ADD KEY `dt_create` (`dt_create`),
  ADD KEY `cnts_id` (`cnts_id`);

--
-- Indexes for table `tbl_game`
--
ALTER TABLE `tbl_game`
  ADD PRIMARY KEY (`game_id`),
  ADD KEY `dt_create` (`dt_create`),
  ADD KEY `cnts_id` (`cnts_id`),
  ADD KEY `player_id` (`player_id`),
  ADD KEY `prize_id` (`prize_id`);

--
-- Indexes for table `tbl_ipnlog`
--
ALTER TABLE `tbl_ipnlog`
  ADD PRIMARY KEY (`ipnlog_id`),
  ADD KEY `dt_create` (`dt_create`),
  ADD KEY `email` (`email`);

--
-- Indexes for table `tbl_maillog`
--
ALTER TABLE `tbl_maillog`
  ADD PRIMARY KEY (`maillog_id`),
  ADD KEY `dt_create` (`dt_create`),
  ADD KEY `email` (`email`),
  ADD KEY `sender` (`sender`);

--
-- Indexes for table `tbl_pic`
--
ALTER TABLE `tbl_pic`
  ADD PRIMARY KEY (`pic_id`),
  ADD KEY `dt_create` (`dt_create`),
  ADD KEY `status` (`status`);

--
-- Indexes for table `tbl_price`
--
ALTER TABLE `tbl_price`
  ADD PRIMARY KEY (`price_id`),
  ADD KEY `dt_create` (`dt_create`),
  ADD KEY `cnts_id` (`cnts_id`),
  ADD KEY `status` (`status`),
  ADD KEY `sig` (`sig`);

--
-- Indexes for table `tbl_prize`
--
ALTER TABLE `tbl_prize`
  ADD PRIMARY KEY (`prize_id`) USING BTREE,
  ADD KEY `cnts_id` (`cnts_id`);

--
-- Indexes for table `tbl_sync`
--
ALTER TABLE `tbl_sync`
  ADD PRIMARY KEY (`sync_id`),
  ADD KEY `key` (`key`);

--
-- Indexes for table `tbl_tmpdb`
--
ALTER TABLE `tbl_tmpdb`
  ADD PRIMARY KEY (`tmpdb_id`),
  ADD KEY `dt_create` (`dt_create`),
  ADD KEY `tid` (`tid`),
  ADD KEY `tkey` (`tkey`);

--
-- Indexes for table `tbl_trans`
--
ALTER TABLE `tbl_trans`
  ADD PRIMARY KEY (`trans_id`),
  ADD KEY `cnts_id` (`cnts_id`),
  ADD KEY `tid` (`tid`),
  ADD KEY `player_id` (`player_id`);

--
-- Indexes for table `tbl_turn`
--
ALTER TABLE `tbl_turn`
  ADD PRIMARY KEY (`turn_id`),
  ADD KEY `game_id` (`game_id`);

--
-- Indexes for table `tbl_user`
--
ALTER TABLE `tbl_user`
  ADD PRIMARY KEY (`user_id`),
  ADD KEY `status` (`status`),
  ADD KEY `username` (`username`),
  ADD KEY `sess_token` (`sess_token`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `tbl_access`
--
ALTER TABLE `tbl_access`
  MODIFY `access_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;

--
-- AUTO_INCREMENT for table `tbl_cfgdb`
--
ALTER TABLE `tbl_cfgdb`
  MODIFY `cfgdb_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1008;

--
-- AUTO_INCREMENT for table `tbl_cnts`
--
ALTER TABLE `tbl_cnts`
  MODIFY `cnts_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;

--
-- AUTO_INCREMENT for table `tbl_errlog`
--
ALTER TABLE `tbl_errlog`
  MODIFY `errlog_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;

--
-- AUTO_INCREMENT for table `tbl_game`
--
ALTER TABLE `tbl_game`
  MODIFY `game_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;

--
-- AUTO_INCREMENT for table `tbl_ipnlog`
--
ALTER TABLE `tbl_ipnlog`
  MODIFY `ipnlog_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;

--
-- AUTO_INCREMENT for table `tbl_maillog`
--
ALTER TABLE `tbl_maillog`
  MODIFY `maillog_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;

--
-- AUTO_INCREMENT for table `tbl_pic`
--
ALTER TABLE `tbl_pic`
  MODIFY `pic_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;

--
-- AUTO_INCREMENT for table `tbl_price`
--
ALTER TABLE `tbl_price`
  MODIFY `price_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;

--
-- AUTO_INCREMENT for table `tbl_prize`
--
ALTER TABLE `tbl_prize`
  MODIFY `prize_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;

--
-- AUTO_INCREMENT for table `tbl_sync`
--
ALTER TABLE `tbl_sync`
  MODIFY `sync_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;

--
-- AUTO_INCREMENT for table `tbl_tmpdb`
--
ALTER TABLE `tbl_tmpdb`
  MODIFY `tmpdb_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;

--
-- AUTO_INCREMENT for table `tbl_trans`
--
ALTER TABLE `tbl_trans`
  MODIFY `trans_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;

--
-- AUTO_INCREMENT for table `tbl_turn`
--
ALTER TABLE `tbl_turn`
  MODIFY `turn_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1001;

--
-- AUTO_INCREMENT for table `tbl_user`
--
ALTER TABLE `tbl_user`
  MODIFY `user_id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1002;
COMMIT;

