-
Notifications
You must be signed in to change notification settings - Fork 0
/
bewertung.php
128 lines (114 loc) · 3.51 KB
/
bewertung.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
<?php
session_start();
if(isset($_SESSION["username"])) {
?>
<!DOCTYPE html>
<html>
<head>
<title>Bewertung</title>
</head>
<body>
<h1>Willkommen <?php echo $_SESSION["username"]; ?></h1><br />
<a href="logout.php">Logout</a>
<br /><br /><br />
<?php
if(!isset($_GET["page"])) {
?>
<!-- Bewertung Start-->
<h2>Bewertung:</h2>
<form method="post" action="bewertung.php?page=2">
<fieldset>
<h3>Produkt 1</h3>
<input type="radio" name="productOne" value="1">
<label>1</label>
<input type="radio" name="productOne" value="2">
<label>2</label>
<input type="radio" name="productOne" value="3">
<label>3</label>
<input type="radio" name="productOne" value="4">
<label>4</label>
<input type="radio" name="productOne" value="5">
<label>5</label>
</fieldset>
<br />
<fieldset>
<h3>Produkt 2</h3>
<input type="radio" name="productTwo" value="1">
<label>1</label>
<input type="radio" name="productTwo" value="2">
<label>2</label>
<input type="radio" name="productTwo" value="3">
<label>3</label>
<input type="radio" name="productTwo" value="4">
<label>4</label>
<input type="radio" name="productTwo" value="5">
<label>5</label>
</fieldset>
<br />
<fieldset>
<h3>Produkt 3</h3>
<input type="radio" name="productThree" value="1">
<label>1</label>
<input type="radio" name="productThree" value="2">
<label>2</label>
<input type="radio" name="productThree" value="3">
<label>3</label>
<input type="radio" name="productThree" value="4">
<label>4</label>
<input type="radio" name="productThree" value="5">
<label>5</label>
</fieldset>
<br />
<fieldset>
<h3>Produkt 4</h3>
<input type="radio" name="productFour" value="1">
<label>1</label>
<input type="radio" name="productFour" value="2">
<label>2</label>
<input type="radio" name="productFour" value="3">
<label>3</label>
<input type="radio" name="productFour" value="4">
<label>4</label>
<input type="radio" name="productFour" value="5">
<label>5</label>
</fieldset>
<br />
<input type="submit" value="Bewertungen abschicken">
</form>
<?php
}
?>
<?php
if(isset($_GET["page"])) {
if($_GET["page"] == "2") {
$username = $_SESSION["username"];
$pOne = $_POST["productOne"];
$pTwo = $_POST["productTwo"];
$pThree = $_POST["productThree"];
$pFour = $_POST["productFour"];
$verbindung = mysql_connect("localhost", "Brandao", "haw")
or die ("Fehler im System");
mysql_select_db("htmlworld")
or die ("Verbindung zur Datenbank war nicht möglich...");
$eintrag = "UPDATE login SET productOne='$pOne', productTwo='$pTwo', productThree='$pThree', productFour='$pFour' WHERE user = '$username'";
$eintragen = mysql_query($eintrag);
if($eintragen == true) {
echo "Vielen dank für die Bewertung! <a href=\"durchschnitt.php\">Zum Durchschnitt</a>";
}
else {
echo "Fehler im System. Bitte später nochmal versuchen...";
}
mysql_close($verbindung);
}
}
?>
</body>
</html>
<?php
}
else {
?>
Bitte einloggen... <a href="index.php">hier</a>
<?php
}
?>