Ik heb een website gemaakt voor de winkel van mijn vrouw, en op de html-pagina met haar contactgegevens heb ik een php-contactformulier gezet dat ik ergens op het internet vond.
Nu stel ik vast dat je dit kan verzenden ook als je niks hebt ingevuld. Kan iemand mij helpen om dit te beveiligen. Ik heb zelf weinig kaas gegeten van php, vandaar mijn postje op dit forum.
Het php bestandje mail.php ziet er zo uit :
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$formcontent="From: $name \n Telefoon; $phone \n Message: $message";
//verander hieronder je emailadres
$recipient = "[email protected]";
//verander hieronder evt de teksten en de html
$subject = "Aanvraag via de website van ArteShop";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "
<h3>Bedankt! Uw bericht werd goed verzonden. We nemen zo snel mogelijk contact met u op.<br />
<a href='index.html'>Terug naar de website van ArteShop</a></h3>
";
?>
En het html-bestand contact.html ziet er zo uit :
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" name="keywords" content="ArteShop, lederwaren, juwelen, jewels, bags, fashion">
<title>Arte Shop</title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<style type="text/css">
<!--
.style5 {font-family: Arial, Helvetica, sans-serif}
.style6 {color: #333333}
.style3 {
color: #333333;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
}
.style7 {font-size: 12px}
.style12 {font-weight: bold}
.style14 {color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 20px; font-weight: bold; }
-->
</style>
</head>
<body>
<div class="header" style="display:block;">
<div>
<img src="images/logoarteshop2.png" alt="" width="327">
<ul>
<li>
<a href="index.html">Home</a>
</li>
<li>
<a href="about.html">About</a>
</li>
<li>
<a href="#">Collections</a>
<ul>
<li>
<a href="jewels.html">Jewels</a>
</li>
<li>
<a href="handbags.html">Bags</a>
</li>
<li>
<a href="fashion.html">Fashion</a>
</li>
</ul>
</li>
<li>
<a href="shop.html">Shop</a>
</li>
<li>
<a href="contact.html">Contact</a>
</li>
</ul>
</div>
</div>
<div class="body">
<div>
<div class="collections">
<div class="navigation">
<ul>
<li class="selected">
<a href="#">CONTACT ARTESHOP</a>
</li>
</ul>
</div>
<div>
<table width="100%" height="100%" border="0">
<tr>
<td height="86" colspan="5"><div align="center"><span class="style14"><br>ARTESHOP- Straat 12 - 9999 De Gemeente- Tel. 059 99 99 99</span></div></td>
</tr>
</table>
<table width="100%" height="100%" border="0">
<tr>
<td width="266" rowspan="10"><img src="images/figure34.jpg" alt="" width="218" style="border:1px solid white"></td>
<td> </td>
<td colspan="3"><span class="style3">OPENINGSUREN </span></td>
</tr>
<tr>
<td> </td>
<td colspan="3"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td width="8"> </td>
<td width="143"><span class="style7 style6 style5 style12"><strong>Maandag</strong></span></td>
<td colspan="2"><span class="style7 style6 style5"><strong>gesloten</strong></span></td>
</tr>
<tr>
<td> </td>
<td><span class="style7 style6 style5 style2"><strong>Dinsdag</strong></span></td>
<td width="135"><span class="style7 style6 style5 style2"><strong>10:00-12:30</strong></span></td>
<td width="370"><span class="style7 style6 style5 style2"><strong>14:00-18:00</strong></span></td>
</tr>
<tr>
<td> </td>
<td><span class="style7 style6 style5 style2"><strong>Woensdag</strong></span></td>
<td><span class="style7 style6 style5 style2"><strong>10:00-12:30</strong></span></td>
<td><span class="style7 style6 style5 style2"><strong>14:00-18:00</strong></span></td>
</tr>
<tr>
<td> </td>
<td><span class="style7 style6 style5 style2"><strong>Donderdag</strong></span></td>
<td><span class="style7 style6 style5 style2"><strong>10:00-12:30</strong></span></td>
<td><span class="style7 style6 style5 style2"><strong>14:00-18:00</strong></span></td>
</tr>
<tr>
<td> </td>
<td><span class="style7 style6 style5 style2"><strong>Vrijdag</strong></span></td>
<td><span class="style7 style6 style5 style2"><strong>10:00-12:30</strong></span></td>
<td><span class="style7 style6 style5 style2"><strong>14:00-18:00</strong></span></td>
</tr>
<tr>
<td> </td>
<td><span class="style7 style6 style5 style2"><strong>Zaterdag</strong></span></td>
<td><span class="style7 style6 style5 style2"><strong>10:00-12:30</strong></span></td>
<td><span class="style7 style6 style5 style2"><strong>14:00-18:00</strong></span></td>
</tr>
<tr>
<td> </td>
<td><span class="style7 style6 style5 style2"><strong>Zondag</strong></span></td>
<td colspan="2"><span class="style7 style6 style5 style2"><strong>10:00-13:00 (enkel tijdens schoolvakanties)</strong></span></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td height="86" colspan="5"><div align="center"><span class="style3"><br>
Hebt u een vraag, een klacht of een opmerking ? ArteShop staat klaar om ze te beantwoorden. <br>
U kunt ons bereiken per telefoon of door gebruik te maken van onderstaand contactformulier.</span></div></td>
</tr>
</table>
<style>
input, textarea {
padding:5px;
border:2px solid #ccc;
border-radius: 5px;
width="60";
font:12px Verdana;
margin-bottom:10px;
}
input[type=submit] {
padding:5px 15px;
background:#ccc;
border:0 none;
cursor:pointer;
width:100px;
border-radius: 5px; }
input[type=submit]:active {
padding:5px 15px;
background:#cdc;
}
</style>
<form name="contactform" method="post" action="mail.php">
<div align="center">
<input type="text" name="name" placeholder="Naam" size="60"/>
<br />
<input type="email" name="email" placeholder="Email" size="60"/>
<br />
<input type="text" name="phone" placeholder="Telefoonnummer" size="60"/>
<br />
<textarea name="message" placeholder="Bericht" cols="60" rows="6"></textarea>
<br />
<br />
<input type="submit" value="Verzenden" />
</div>
</form>
<table width="870" height="49%" border="0">
<tr>
<td width="614"><iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2496.132492806767!2d3.0341832000000113!3d51.27188020000002!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x47dcaafb4d232d9b%3A0x6d658c1be745677e!2sArte+Mio!5e0!3m2!1snl!2sbe!4v1440675281009" width="100%" height="349" frameborder="0" style="border:1px solid white" allowfullscreen></iframe></t>
<td width="22">
<td width="220"> <img src="images/figure5.jpg" width="218" height="349" style="border:1px solid white">
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="footer">
<div>
<p>
© 2015 DIRK DE COSTER</p>
<div class="connect"> <a href="index.html" id="facebook">Facebook</a> <a href="https://www.google.be/maps/place/Arte+Shop/@51.2719902,3.0341832,17z/data=!3m1!4b1!4m2!3m1!1s0x47dcaafb4d232d9b:0x6d568c1be745677e" id="googleplus">Google+</a>
</div>
</div>
</div>
</body>
</html>
Voor alle duidelijkheid : ik heb hier en daar wat gegevens (mail adres - telefoonnummer, etc ...) gewijzigd in dit script om de privacy te bewaren.
Hopelijk kan iemand mij helpen ?
Alvast bedankt,
Dirk