-
Notifications
You must be signed in to change notification settings - Fork 0
/
klantenservice_niet_beantwoord.php
63 lines (52 loc) · 1.69 KB
/
klantenservice_niet_beantwoord.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
<!--
Klant komt op deze pagina terecht als zijn vraag via de interactieve klantenservice niet is beantwoord.
-->
<?php
//deze functie geeft het formulier weer.
function show_form()
{
echo "Uw gegevens worden automatisch met het bericht meegestuurd naar onze klantenservice!";
echo "<form method='post' action='klantenservice_niet_beantwoord.php'>
<br /><br />
Bericht:<br />
<textarea name='bericht' rows='15' cols='40'>
</textarea><br />
<input type='submit' value='verstuur' />
<br /><br />
</form>";
}
//Er word getest of de klant is ingelogd
if (!isset($_SESSION['logged-in'])) {
?>
<pre>
U bent niet ingelogd!
</pre>
<?php
} else {
?>
<div class="centered-container">
<div class="account-wachtwoord-veranderen">
<h1><b>Klantenserviceformulier</b></h1>
<hr width="100%"><br />
<?php
//als formulier is ingevuld dan worden de gegevens verstuurd. Vanuit de session worden de klantgegevens opgehaald
//waardoor de klantgegevens samen met het bericht naar de klantenservice worden verstuurd.
if (isset($_POST['bericht'])) {
$id = $_SESSION['gebruiker-id'] ;
$naam = $_SESSION['gebruiker-naam'] ;
$onderwerp = "Vraag niet beantwoord" ;
$db = connect_to_db();
$sql = $db->prepare("SELECT email FROM Gebruikers WHERE id = ? LIMIT 1");
$sql->bind_param("s", $id);
$sql->execute();
$sql->bind_result($email);
$sql->fetch();
$bericht = $_POST['bericht'] ;
mail("[email protected]", $onderwerp,
$bericht, "From:" . $email);
?><br /><div align="center">Hartelijk dank voor uw reactie, wij streven er naar uw vraag binnen 1 werkdag te beantwoorden.<br /><br /></div><?php
} else {
show_form();
}
}
?>