blob: 375225b9b28b136821468d9352708d1675575dc5 [file] [log] [blame]
Andreu8192d552019-09-22 16:51:39 +02001<?php
2 require '../credentials.php';
3 require '../php/utils.php';
4
5 $dbname = $_GET['dbname'];
Andreu0530b302019-09-24 04:18:20 +02006 $mortsname = $dbname . "_morts";
Andreu8192d552019-09-22 16:51:39 +02007
Andreu0530b302019-09-24 04:18:20 +02008 $queries = ["CREATE TABLE `$dbname` (
Andreu8192d552019-09-22 16:51:39 +02009 `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
10 `nom` varchar(100) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
11 `curs` tinyint(1) NOT NULL,
12 `grau` tinyint(1) NOT NULL,
13 `quimata` int(11) NOT NULL,
14 `requested` tinyint(1) NOT NULL DEFAULT 0,
15 `mort` tinyint(1) NOT NULL DEFAULT 0,
Andreu0530b302019-09-24 04:18:20 +020016 `password` varchar(100) NOT NULL DEFAULT '',
17 `bits` int(3) NOT NULL
18 )",
19 "CREATE TABLE `$mortsname` (
Andreu04f79ef2019-09-22 18:52:19 +020020 `id` int(11) NOT NULL,
21 `quimatava` int(11) NOT NULL,
22 `assassi` int(11) NOT NULL,
23 `curs` tinyint(1) NOT NULL,
24 `grau` tinyint(1) NOT NULL,
25 `data` date NOT NULL DEFAULT current_timestamp()
Andreu0530b302019-09-24 04:18:20 +020026 )"];
27
28 foreach ($queries as $query) if (!query($query)) die('An error ocurred.');
29 die("<script>window.location.href = './index.php?dbname=$dbname'</script>");
Andreu8192d552019-09-22 16:51:39 +020030?>