-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
102 lines (71 loc) · 2.47 KB
/
admin.php
File metadata and controls
102 lines (71 loc) · 2.47 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
<!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>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="header">
<div class="navLinkDiv">
<div class="ulNav">
<form action="test.php" class="firstLink"><button class="logButton">Events</button></form>
<?php
session_start();
if (!isset($_SESSION['user'])){ ?>
<form action="inlog.php"><button class="logButton">Inloggning</button></form>
<?php } else if ($_SESSION['user']=='inloggad'){ ?>
<form action="admin.php" class="secondLink"><button class="logButton">Admin</button></form>
<form action="utlog.php"><button class="logButton">Utloggning</button></form>
<?php } ?>
</div>
</div>
<div class="clubName">Admin</div>
</div><!-- End of header-->
<?php
if ($_SESSION['user']=='inloggad'){
$db=mysqli_connect('localhost', '***', '***', "***") or die('Error connecting to database server');
$db -> set_charset("utf8");
$sql = "SELECT * FROM forening";
$result = mysqli_query($db,$sql) or die('Kunde inte läsa från tabellen');
?>
<div class="addAndRemove">
<div class="addCard">
<div class="addCardHeader">Lägg till</div>
<form action="add.php" method="post">
<div><label for="Rubrik">Rubrik</label></div>
<input id="Rubrik" type="text" name="Rubrik" maxlength="100"/>
<br>
<div><label for="Event">Event</label></div>
<textarea id="Event" cols="20" rows="15" type="text" name="Event" maxlength="500"></textarea>
<br>
<div><label for="Datum">Datum</label></div>
<input id="Datum" type="date" name="Datum"/>
<br>
<div><label for="Info">Info</label></div>
<textarea id="Info" cols="20" rows="3" type="text" name="Info" maxlength="100"></textarea>
<br>
<input type="submit" id="rullGardRadera" value="Lägg till">
</form>
</div>
<div class="removeCard">
<div class="addCardHeader">Ta bort</div>
<form method="get" action="remove.php">
<select id="rullGard" name="delete">
<?php while ($row = mysqli_fetch_array($result)) {
?>
<option value="<?php echo $row['rubrik'];?>"><?php echo $row['rubrik'];?></option>
<?php } ?>
</select>
<input id="rullGardRadera" type="submit" value="Radera">
</form>
</div>
</div><!-- End of addAndRemove-->
<?php
}
mysqli_close($db);
?>
</body>
</html>