-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreacties.php
More file actions
186 lines (167 loc) · 5.88 KB
/
Copy pathreacties.php
File metadata and controls
186 lines (167 loc) · 5.88 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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<? require_once('connection.php'); ?>
<!doctype html>
<html manifest="thema.appcache" class="no-js" lang="en">
<head>
<meta charset="utf-8">
<title>.: Info :.</title>
<link rel="icon" href="img/favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="css/style.css" title="default">
<link rel="roze stylesheet" type="text/css" href="css/style_roze.css" title="roze" />
<link rel="blauwroze stylesheet" type="text/css" href="css/style_blauw_roze.css" title="blauwroze" />
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="scripts/switcher.js"></script>
<script src="scripts/script.js"></script>
</head>
<body>
<div id="container">
<div id="headercolor">
<div id="container_breedte">
<header id="logo_plek"><a href="index.php" id="logo"><img width="333" src="img/logo.png" alt="" /></a></header>
<nav id="menu">
<ul>
<li class='active'><a href='index.php'><span>Home</span></a></li>
<li class='has-sub'><a href='#'><span>Babykaartjes</span></a>
<ul>
<li class='has-sub'><a href='#'><span>tekst</span></a>
<ul>
<li><a href='#'><span>tekst</span></a></li>
<li class='last'><a href='#'><span>tekst</span></a></li>
</ul>
</li>
<li class='has-sub'><a href='#'><span>tekst</span></a>
<ul>
<li><a href='#'><span>tekst</span></a></li>
<li class='last'><a href='#'><span>tekst</span></a></li>
</ul>
</li>
</ul>
</li>
<li><a href='info.php'><span>Informatie</span></a></li>
<? if(empty($_SESSION['user'])) { ?>
<li><a href='login.php'><span>Inloggen</span></a></li>
<? } else { ?>
<li><a href='ingelogd.php'><span>Account</span></a></li>
<? } ?>
<li class='last'><a href='contact.php'><span>Contact</span></a></li>
</ul>
<div id="styleswitchen">
<div id="styleswitchvak1"><a href="#" onclick="setActiveStyleSheet('default'); return false;"><img src="img/clear.png" height="20" width="20" alt="" /></a></div>
<div id="styleswitchvak2"><a href="#" onclick="setActiveStyleSheet('roze'); return false;"><img src="img/clear.png" height="20" width="20" alt="" /></a></div>
<div id="styleswitchvak3"><a href="#" onclick="setActiveStyleSheet('blauwroze'); return false;"><img src="img/clear.png" height="20" width="20" alt="" /></a></div>
</div>
</nav>
</div>
</div>
<div class="blauwelijn"></div>
<div id="tussen_balk"></div>
<div id="titelbalk">Informatie</div>
<hr class="schaduw_lijn"></hr>
<div id="container_content">
<?
if((isset($_POST["reageer"]))) {
$reactie = $_REQUEST['bericht'];
//datum ophalen
$now = time();
$num = date("w");
if ($num == 0)
{ $sub = 6; }
else { $sub = ($num-1); }
$WeekMon = mktime(0, 0, 0, date("m", $now) , date("d", $now)-$sub, date("Y", $now));
$todayh = getdate($WeekMon);
$d = $todayh[mday] + 1;
$m = $todayh[mon];
$y = $todayh[year];
//eind datum ophalen
$datumreactie = ("$y-$m-$d");
$gebruikersnaam = $_SESSION['user']['gebruikersnaam'];
$idbabykaart = $_SESSION['id'];
if(!empty($_POST)) {
if(empty($_POST['bericht'])) {
$fout_naam = true;
$sucess = false;
}
if (!$sucess) {
$query = "
INSERT INTO reacties(
bericht,
datumreactie,
gebruikersnaam,
babyid
) VALUES (
:reactie,
:datumreactie,
:gebruikersnaam,
:babyid
)
";
$query_params = array(
':reactie' => $_POST['bericht'],
':datumreactie' => $datumreactie,
':gebruikersnaam' => 'henk',
':babyid' => '1',
);
try {
$stmt = $db->prepare($query);
$result = $stmt->execute($query_params);
} catch(PDOException $ex) {
die("FOUT: " . $ex->getMessage());
$PDOException = true;
}
if (!$PDOException) {
$sucess = true;
}
}
}
}
$opdracht = "SELECT * FROM reacties";
try {
$stmt = $db->prepare($opdracht);
$result = $stmt->execute();
} catch(PDOException $ex) {
// TODO: verwijder de 'die' op uiteindelijke website
die("FOUT: " . $ex->getMessage());
}
$rij = $stmt->fetchAll();
?>
<div id="reacties">
<form action="" method="post">
Reactie:
<textarea name="bericht" cols="" rows="">
</textarea>
<br>
<input name="reageer" value="Reageer" type="submit">
</form>
<?
echo "<table border='1' width='700px'>";
foreach($rij as $veld){
echo "<tr>";
echo "<tr style='font-family: OpenSans-Bold'>Naam: </tr>";
echo "<tr>" . $veld['gebruikersnaam'] . "<br></tr>";
echo "<tr style='font-family: OpenSans-Bold'>Datum: </tr>";
echo "<tr>" . $veld['datumreactie'] . "<br></tr>";
echo "<tr style='font-family: OpenSans-Bold'>Bericht: <br></tr>";
echo "<tr>" . $veld['bericht'] . "<br></tr>";
echo "</tr>";
}
echo "</table>";
?>
</div>
</div>
<footer id="footer">
<div class="blauwelijn"></div>
<div id="footer_content">
<div id="footer_socialmedia_iconen">
<a href="https://plusone.google.com/_/+1/confirm?hl=en&url=http://tmtg03.ict-lab.nl/website" target="_blank"><img src="img/google.png" alt="" /></a>
<a href="https://www.facebook.com/sharer/sharer.php?u=http://tmtg03.ict-lab.nl/website" target="_blank"><img src="img/facebook.png" alt="" /></a>
<a href="http://twitter.com/home?status=http://tmtg03.ict-lab.nl/website" target="_blank"><img src="img/twitter.png" alt="" /></a>
</div>
<div id="footer_copyright">
<p class="copyright_tekst">© 2013 www.babyberichten.nl</p>
</div>
</div>
</footer>
</div>
</body>
</html>