Andreu | 8192d55 | 2019-09-22 16:51:39 +0200 | [diff] [blame] | 1 | <?php |
| 2 | require '../credentials.php'; |
| 3 | require '../php/utils.php'; |
| 4 | |
| 5 | $dbname = $_GET['dbname']; |
Andreu | 0530b30 | 2019-09-24 04:18:20 +0200 | [diff] [blame] | 6 | $mortsname = $dbname . "_morts"; |
Andreu | 8192d55 | 2019-09-22 16:51:39 +0200 | [diff] [blame] | 7 | |
Andreu | 0530b30 | 2019-09-24 04:18:20 +0200 | [diff] [blame] | 8 | $queries = ["CREATE TABLE `$dbname` ( |
Andreu | 8192d55 | 2019-09-22 16:51:39 +0200 | [diff] [blame] | 9 | `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, |
Andreu | 0530b30 | 2019-09-24 04:18:20 +0200 | [diff] [blame] | 16 | `password` varchar(100) NOT NULL DEFAULT '', |
| 17 | `bits` int(3) NOT NULL |
| 18 | )", |
| 19 | "CREATE TABLE `$mortsname` ( |
Andreu | 04f79ef | 2019-09-22 18:52:19 +0200 | [diff] [blame] | 20 | `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() |
Andreu | 0530b30 | 2019-09-24 04:18:20 +0200 | [diff] [blame] | 26 | )"]; |
| 27 | |
| 28 | foreach ($queries as $query) if (!query($query)) die('An error ocurred.'); |
| 29 | die("<script>window.location.href = './index.php?dbname=$dbname'</script>"); |
Andreu | 8192d55 | 2019-09-22 16:51:39 +0200 | [diff] [blame] | 30 | ?> |