-
Notifications
You must be signed in to change notification settings - Fork 2
/
newcollection.php
143 lines (116 loc) · 4.27 KB
/
newcollection.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
ob_start();
use src\php\classes\Collection\Collection;
include_once("bootstrap.php");
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//var_dump($_POST);
//var_dump($_SESSION["userId"]);
if (isset($_POST["pokemon"])) {
try {
$col = new Collection();
$currentUserId = $_SESSION["userId"];
$col->setCollectionName($_POST["name"]);
// $user->checkEmail();
$col->setCollectionType($_POST["pokemon"]);
// $user->checkUsername();
if (empty($_POST["private"])) {
$_POST["private"] = "private";
}
$col->setCollectionPrivate($_POST["private"]);
$col->saveCollection($currentUserId);
header("Location: index.php");
} catch (\Throwable $th) {
$error = $th->getMessage();
}
}
if (isset($_POST["yugioh"])) {
try {
$col = new Collection();
$currentUserId = $_SESSION["userId"];
$col->setCollectionName($_POST["name"]);
// $user->checkEmail();
$col->setCollectionType($_POST["yugioh"]);
// $user->checkUsername();
$col->setCollectionPrivate($_POST["private"]);
$col->saveCollection($currentUserId);
header("Location: index.php");
} catch (\Throwable $th) {
$error = $th->getMessage();
}
}
if (isset($_POST["MTG"])) {
try {
$col = new Collection();
$currentUserId = $_SESSION["userId"];
$col->setCollectionName($_POST["name"]);
// $user->checkEmail();
$col->setCollectionType($_POST["MTG"]);
// $user->checkUsername();
$col->setCollectionPrivate($_POST["private"]);
$col->saveCollection($currentUserId);
header("Location: index.php");
} catch (\Throwable $th) {
$error = $th->getMessage();
}
}
include_once("header.inc.php");
include_once("navbar.inc.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/bottom-navbar/collection_bar.css">
<link rel="stylesheet" href="css/newcollection.css">
<title>Epicards | new collection</title>
</head>
<body>
<div class="newcollection_container">
<div class="top">
<button onclick="history.go(-1);"><img src="assets/back_arrow.svg" alt="back arrow" class="back_arrow"></button>
<h1>Add collection</h1>
</div>
<div class="scroll_container">
<form action="" method="POST">
<div class="checkbox_public">
<h3 for="unprivate" class="pointer">Make Collection</h3>
<select name="private" id="unprivate">
<option value="private">Private </option>
<option value="unprivate">Public</option>
</select>
</div>
<div class="collection_input">
<!-- <h3>Collection name</h3> -->
<label for="collection_input" class="input_label">Collection name</label>
<input type="name" placeholder="Enter the name of your collection" name="name" class="input_field" required="required" id="collection_input">
</div>
<div class="collection_type">
<h3>Type collection</h3>
<div class="type_buttons">
<label>
<input id="Check1" onclick="selectOnlyThis(this.id)" type="checkbox" name="pokemon" value="pokemon" class="collection_type_button pkmn_type">
<img src="assets/pkmn_logo.svg" alt="pokemon logo" class="cardlogos pkmn_type">
</label>
<label>
<input id="Check2" onclick="selectOnlyThis(this.id)" type="checkbox" name="yugioh" value="yugioh" class="collection_type_button yug_type">
<img src="assets/yug_logo.svg" alt="yu-gi-oh! logo" class="cardlogos yug_type">
</label>
<label>
<input id="Check3" onclick="selectOnlyThis(this.id)" type="checkbox" name="MTG" value="MTG" class="collection_type_button mtg_type">
<img src="assets/mtg_logo.svg" alt="Magic: The Gathering logo" class="cardlogos mtg_type">
</label>
</div>
</div>
<button type="submit" name="collection" class="btn make-coll_btn">save</button>
</form>
<div class="hidden_block">hidden</div>
</div>
</div>
</body>
<script src="src/js/collection.js"></script>
</html>