-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit.php
More file actions
115 lines (106 loc) · 3.92 KB
/
Copy pathedit.php
File metadata and controls
115 lines (106 loc) · 3.92 KB
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
<?php
require "connect.php";
// If the user is not logged in or not an admin, they should be redirected to the homepage
if ($_SESSION["logged"]) {
$sql = "SELECT * FROM userdata WHERE username = ?;";
$users = $pdo->prepare($sql);
$users->execute([$_SESSION["username"]]);
$user = $users->fetch();
$name = $_SESSION["username"];
$logged = true;
} else {
$name = "Account";
$logged = false;
header("Location: index.php");
}
if ($user["admin"] == "no") {
header("Location: index.php?no");
}
$sql = "SELECT * FROM gamemerch WHERE id=?;";
$games = $pdo->prepare($sql);
$games->execute([$_GET["id"]]);
$currentprod = $games->fetch();
if ($_GET["id"] == "") {
header("Location: productlist.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">
<title>Bewerken</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<nav class="topnav" id="myTopnav">
<div>
<a href="index.php">
<h1 class="title">Merchandise</h1>
</a>
</div>
<div class="linkdiv">
<a href="manageusers.php" class="links">Users</a>
<a href="productlist.php" class="links active">Products</a>
<a href="addproduct.php" class="links">Add product</a>
</div>
<?php if ($logged) : ?>
<div class="linkdiv account left">
<?php if (isset($user["pfp"])) : ?>
<img src="media/pfp/<?= $user["pfp"] ?>" alt="">
<?php endif; ?>
<div class="dropdown">
<button class="dropbtn"><?= $name ?>
<i class="fa fa-caret-down"></i>
</button>
<div class="dropdown-content accountcontent">
<a href="favs.php">Favorieten</a>
<a href="profile.php">Mijn profiel</a>
<a href="logout.php">Uitloggen</a>
</div>
</div>
</div>
<?php else : ?>
<div class="left">
<a href="login.php" class="links account">Inloggen</a>
</div>
<?php endif; ?>
</nav>
<div class="tablediv">
<form action="editdone.php" method="post" enctype="multipart/form-data" class="stylish">
<input type="text" name="id" id="id" value="<?= $currentprod["id"] ?>" class="invisible">
<table class="noborder">
<tr>
<th>Itemnaam</th>
<td><input type="text" name="itemnaam" id="itemnaam" value="<?= $currentprod["naam"] ?>"></td>
</tr>
<tr>
<th>Foto</th>
<td><input type="file" name="foto" id="foto" value="<?= $currentprod["foto"] ?>"></td>
</tr>
<tr>
<th>Game</th>
<td><input type="text" name="game" id="game" value="<?= $currentprod["game"] ?>"></td>
</tr>
<tr>
<th>Prijs</th>
<td><input type="text" name="prijs" id="prijs" value="<?= $currentprod["prijs"] ?>"></td>
</tr>
<tr>
<th>Voorraad</th>
<td><input type="number" name="voorraad" id="voorraad" value="<?= $currentprod["voorraad"] ?>"></td>
</tr>
<tr>
<th>Beschrijving</th>
<td><input type="text" name="beschrijving" id="beschrijving" value="<?= $currentprod["beschrijving"] ?>"></td>
</tr>
<tr>
<th></th>
<td><input type="submit" value="Submit" class="hovershadow"></td>
</tr>
</table>
</form>
</div>
</body>
</html>