Ik heb een script waarbij mensen iets kunnen bestellen en die bestelling moet naar mij gemaild worden, helaas gebeurd dat niet, nu heb ik in het logboek gekeken en daarin staat het volgende:
[Sat Sep 04 21:43:51 2010] [error] [client 213.17.124.140] PHP Notice: Undefined index: ingelogd in /var/www/vhosts/pannenkoekenaanhuis.nl/httpdocs/include/defines.php on line 14, referer: http://www.pannenkoekenaanhuis.nl/index.php?p=winkelmand
[Sat Sep 04 21:43:51 2010] [error] [client 213.17.124.140] PHP Notice: Undefined variable: totaal in /var/www/vhosts/pannenkoekenaanhuis.nl/httpdocs/pagina/winkelmand.php on line 61, referer: http://www.pannenkoekenaanhuis.nl/index.php?p=winkelmand
[Sat Sep 04 21:43:51 2010] [error] [client 213.17.124.140] ALERT - mail() - To: headers aren't allowed in the headers parameter. (attacker '213.17.124.140', file '/var/www/vhosts/pannenkoekenaanhuis.nl/httpdocs/pagina/winkelmand.php', line 95), referer: http://www.pannenkoekenaanhuis.nl/index.php?p=winkelmand
Er is dus iets mis met mijn hearder? Maar ik kan niet ontdekken wat. Dit is het stukje code waarvan ik denk dat de fout zou moeten zitten
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: '.$config['bedrijf'].' <'.$config['email'].'>' . "\r\n";
$headers .= 'From: '.$config['bedrijf'].' <'.$config['email'].'>' . "\r\n";
// Versturen
if($config['mailen']){
mail($config['email'], $onderwerp, $bericht, $headers);
Voor de zekerheid ook maar even de volledige code:
<h1>Winkelmand</h1>
<?php
if($_POST['bestellen']){
if(sizeof($_SESSION['winkelmand']) == 0){
$fout .= "- Winkelmand is leeg<br />";
}
if(!$contactpersoon){
$fout .= "- Contactpersoon ongeldig<br />";
}
if(!$adres){
$fout .= "- Adres ongeldig<br />";
}
if(!$postcode){
$fout .= "- Postcode ongeldig<br />";
}
if(!$woonplaats){
$fout .= "- Woonplaats ongeldig<br />";
}
if(!$telefoon){
$fout .= "- Telefoon ongeldig<br />";
}
if(!$email){
$fout .= "- E-mail ongeldig<br />";
}
if(!isset($akkoord)){
$fout .= "- U dient akkoord te gaan met onze algemene voorwaarden<br />";
}
if(isset($fout)){
echo "<span class=\"rood\">$fout</span><br />";
echo "<input type=\"button\" onclick=\"history.go(-1);\" value=\"Ga terug\" />";
}
else{
// Opmaak
$onderwerp = 'Bestelling via '.$config['website'];
$bericht = '
<html>
<head>
<title>'.$config['bedrijf'].'</title>
</head>
<body>
Geachte heer/mevrouw,
<br /><br />
Er is een bestelling gedaan via '.$config['website'].', hieronder de gegevens.
<br /><br />
<table width="600px">
<tr>
<td width="15%"><b>Aantal</b></td>
<td width="55%"><b>Product</b></td>
<td width="15%"><b>Prijs p/s</td>
<td width="15%"><b>Regeltotaal</b></td>
</tr>
';
foreach($_SESSION['winkelmand'] as $winkelmand){
$bericht .= '
<tr>
<td>'.$winkelmand['aantal'].'</td>
<td>'.$winkelmand['product'].'</td>
<td>€ '.number_format($winkelmand['prijs'], 2).'</td>
<td>€ '.number_format(($winkelmand['prijs'] * $winkelmand['aantal']), 2).'</td>
</tr>';
$totaal = $totaal + ($winkelmand['prijs'] * $winkelmand['aantal']);
}
$bericht .= '
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td colspan="3" align="right"><b>Totaal excl. BTW:</b></td>
<td>€ '.number_format($totaal, 2).'</td>
</tr>
<tr>
<td colspan="3" align="right"><b>Totaal incl. BTW:</b></td>
<td>€ '.number_format($totaal * 1.19, 2).'</td>
</tr>
</table>
<br /><br />
<b>Bestelling door:</b><br />
T.n.v. '.$contactpersoon.'<br />
'.$adres.'<br />
'.$postcode.' '.$woonplaats.'<br />
'.$telefoon.'<br />
'.$email.'
</body>
</html>
';
// Headers
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: '.$config['bedrijf'].' <'.$config['email'].'>' . "\r\n";
$headers .= 'From: '.$config['bedrijf'].' <'.$config['email'].'>' . "\r\n";
// Versturen
if($config['mailen']){
mail($config['email'], $onderwerp, $bericht, $headers);
}
echo "Bestelling succesvol!<br /><br />";
echo "Bedankt voor uw bestelling.";
// Winkelmand legen
unset($_SESSION['winkelmand']);
}
}
else{
if(isset($_GET['verwijderen'])){
if(!$id){
$fout .= "- Product id ongeldig<br />";
}
if(isset($fout)){
echo "<span class=\"rood\">$fout</span><br />";
echo "<input type=\"button\" onclick=\"history.go(-1);\" value=\"Ga terug\" />";
}
else{
$nieuwe_winkelmand = array();
foreach($_SESSION['winkelmand'] as $winkelmand){
if($winkelmand['id'] != $id){
array_push($nieuwe_winkelmand , $winkelmand);
}
}
$_SESSION['winkelmand'] = $nieuwe_winkelmand;
//
echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1; URL=index.php?p=winkelmand\">";
echo "Succesvol verwijderd!";
}
}
else{
if(isset($_POST['update'])){
if($aantal == 0){
unset($_SESSION['winkelmand'][$update]);
}
else{
$_SESSION['winkelmand'][$update]['aantal'] = $aantal;
}
}
?>
<table width="100%">
<tr>
<td width="15%"><b>Aantal</b></td>
<td width="45%"><b>Product</b></td>
<td width="20%"><b>Prijs p/s</td>
<td width="20%"><b>Regeltotaal</b></td>
</tr>
<?php
$i=0;
if(sizeof($_SESSION['winkelmand']) != 0){
foreach($_SESSION['winkelmand'] as $winkelmand){
?>
<tr>
<td>
<form method="post" action="index.php?p=winkelmand">
<input type="hidden" name="update" value="<?= $i; ?>" />
<input type="text" name="aantal" value="<?= $winkelmand['aantal']; ?>" size="2" maxlength="3" />
<input type="image" src="images/icons/refresh.png" name="update" />
</form>
</td>
<td><?= $winkelmand['product']; ?></td>
<td>€ <?= number_format($winkelmand['prijs'], 2); ?></td>
<td>
€ <?= number_format(($winkelmand['prijs'] * $winkelmand['aantal']), 2); ?>
<a href="index.php?p=winkelmand&verwijderen&id=<?= $winkelmand['id']; ?>"><img src="images/icons/delete.png" alt="delete" /></a>
</td>
</tr>
<?php
$totaal = $totaal + ($winkelmand['prijs'] * $winkelmand['aantal']);
$i++;
}
}
else{
?>
<tr>
<td colspan="4">U heeft nog geen producten in de winkelmand geplaatst.</td>
</tr>
<?php } ?>
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td colspan="3"><span class="right"><b>Totaal excl. BTW:</b></span></td>
<td>€ <?= number_format($totaal, 2); ?></td>
</tr>
<tr>
<td colspan="3"><span class="right"><b>Totaal incl. BTW:</b></span></td>
<td>€ <?= number_format($totaal * 1.19, 2); ?></td>
</tr>
</table>
<br /><br />
<h1>Bestellen</h1>
<form method="post" action="index.php?p=winkelmand">
<table width="100%">
<tr>
<td width="35%">Naam:</td>
<td width="65%"><input type="text" name="contactpersoon" /></td>
</tr>
<tr>
<td>Adres:</td>
<td><input type="text" name="adres" /></td>
</tr>
<tr>
<td>Postcode:</td>
<td><input type="text" name="postcode" /></td>
</tr>
<tr>
<td>Woonplaats:</td>
<td><input type="text" name="woonplaats" /></td>
</tr>
<tr>
<td>Telefoon:</td>
<td><input type="text" name="telefoon" /></td>
</tr>
<tr>
<td>E-mail:</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><input type="checkbox" name="akkoord" /> Ik verklaar hierbij dat alle bovenstaande gegevens correct zijn en dat ik volledig akkoord ga met, en kennis heb genomen van de algemene voorwaarden van <?= $config['bedrijf']; ?>.</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="bestellen" value="bestellen" /></td>
</tr>
</table>
</form>
<?php
}
}
?>Hopelijk kunnen jullie mij verder helpen! Want ik kom er niet meer uit!!!!