Ik kan de volgende fout niet vinden.
Elke keer geeft die een accoulade bug.
Wie ziet hem toevallig:
Hij zou op lijn 209 moeten staan.
PHP
<h1 class="titel">Instellingen wijzigen</h1>
<?php
if(isset($_GET['overige'])){
if(isset($_GET['toevoegen'])){
if($_POST['toevoegen']){
if(!$onderdeel){ $fout .= "- Onderdeel ongeldig.<br />"; }
if(!$product){ $fout .= "- Product ongeldig.<br />"; }
if(!is_numeric($prijs)){ $fout .= "- Prijs ongeldig.<br />"; }
//
if(isset($fout)){
echo "<p>$fout</p>";
echo "<input type=\"button\" onclick=\"history.go(-1);\" value=\"Ga terug\" />";
}
else{
$query = "INSERT INTO `producten_overige` (`onderdeel`, `product`, `informatie`, `prijs`, `contract`) VALUES ('$onderdeel', '$product', '$informatie', '$prijs', '$contract')";
mysql_query($query);
//
echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1; URL=index.php?sub=wijzigen&producten&overige\">";
echo "<p>Succesvol toegevoegd.</p>";
}
}
else{
?>
<form method="post" action="index.php?sub=wijzigen&producten&overige&toevoegen">
<table>
<tr>
<td width="25%"><b>Onderdeel:</b></td>
<td width="75%"><input type="text" name="onderdeel" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><b>Product:</b></td>
<td><input type="text" name="product" /></td>
</tr>
<tr>
<td valign="top"><b>Informatie:</b></td>
<td><textarea name="informatie" cols="50" rows="3"></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><b>Prijs:</b></td>
<td><input name="prijs" type="text" size="5" value="0.00" /> (incl. BTW)</td>
</tr>
<tr>
<td><b>Contract:</b></td>
<td>
<select name="contract">
<option value="1">1 Maand</option>
<option value="3">3 Maanden</option>
<option value="6">6 Maanden</option>
<option value="12">12 Maanden</option>
<option value="24">24 Maanden</option>
<option value="0">Nvt</option>
</select>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="toevoegen" value="Toevoegen" /></td>
</tr>
</table>
</form>
<?php
}
}
elseif($_GET['details']){
if($_POST['wijzigen']){
if(!$onderdeel){ $fout .= "- Onderdeel ongeldig.<br />"; }
if(!$product){ $fout .= "- Product ongeldig.<br />"; }
if(!is_numeric($prijs)){ $fout .= "- Prijs ongeldig.<br />"; }
//
if(isset($fout)){
echo "<p>$fout</p>";
echo "<input type=\"button\" onclick=\"history.go(-1);\" value=\"Ga terug\" />";
}
else{
$query = "UPDATE `producten_overige` SET `onderdeel` = '$onderdeel', `product` = '$product', `informatie` = '$informatie', `prijs` = '$prijs', `contract` = '$contract' WHERE `id` = '$details' LIMIT 1";
mysql_query($query);
//
echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1; URL=index.php?sub=wijzigen&producten&overige\">";
echo "<p>Succesvol gewijzigd.</p>";
}
}
else{
$query = mysql_query("SELECT `onderdeel`, `product`, `informatie`, `prijs`, `contract` FROM `producten_overige` WHERE `id` = '$details' LIMIT 1");
while($row = mysql_fetch_object($query)){
?>
<form method="post" action="index.php?sub=wijzigen&producten&overige&details=<?= $details; ?>">
<table>
<tr>
<td width="25%"><b>Onderdeel:</b></td>
<td width="75%"><input type="text" name="onderdeel" value="<?= $row->onderdeel; ?>" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><b>Product:</b></td>
<td><input type="text" name="product" value="<?= $row->product; ?>" /></td>
</tr>
<tr>
<td valign="top"><b>Informatie:</b></td>
<td><textarea name="informatie" cols="50" rows="3"><?= $row->informatie; ?></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><b>Prijs:</b></td>
<td><input name="prijs" type="text" size="5" value="<?= number_format($row->prijs, 2, '.', ''); ?>" /> (incl. BTW)</td>
</tr>
<tr>
<td><b>Contract:</b></td>
<td>
<select name="contract">
<option value="1"<?php if($row->contract == 1){ echo " selected=\"selected\""; } ?>>1 Maand</option>
<option value="3"<?php if($row->contract == 3){ echo " selected=\"selected\""; } ?>>3 Maanden</option>
<option value="6"<?php if($row->contract == 6){ echo " selected=\"selected\""; } ?>>6 Maanden</option>
<option value="12"<?php if($row->contract == 12){ echo " selected=\"selected\""; } ?>>12 Maanden</option>
<option value="24"<?php if($row->contract == 24){ echo " selected=\"selected\""; } ?>>24 Maanden</option>
<option value="0"<?php if($row->contract == 0){ echo " selected=\"selected\""; } ?>>Nvt</option>
</select>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Wijzigen" name="wijzigen" /></td>
</tr>
</table>
</form>
<?php
}
}
}
elseif($_GET['verwijder']){
if(!is_numeric($verwijder)){ $fout .= "- Verwijder ID ongeldig.<br />"; }
//
if(isset($fout)){
echo "<p>$fout</p>";
echo "<input type=\"button\" onclick=\"history.go(-1);\" value=\"Ga terug\" />";
}
else{
$query = "DELETE FROM `producten_overige` WHERE `id` = '$verwijder' LIMIT 1";
mysql_query($query);
//
echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1; URL=index.php?sub=wijzigen&producten&overige\">";
echo "<p>Succesvol verwijderd.</p>";
}
}
else{
?>
<p><a href="index.php?sub=wijzigen&producten&overige&toevoegen"><b>Product toevoegen</b></a></p>
<table>
<tr>
<td width="55%"><b>Product</b></td>
<td width="15%"><b>Prijs</b></td>
<td width="15%"><b>Details</b></td>
</tr>
<?php
$query = mysql_query("SELECT `id`, `product`, `onderdeel`, `prijs` FROM `producten_overige` ORDER BY `id` DESC");
while($row = mysql_fetch_object($query)){
?>
<tr onmouseover="this.bgColor='<?= $config['tabel_bg']; ?>'" onmouseout="this.bgColor=''">
<td><?= $row->product; ?> (<?= $row->onderdeel; ?>)</td>
<td>€ <?= number_format($row->prijs, 2, ',', '.'); ?></td>
<td>
<a href="index.php?sub=wijzigen&producten&overige&details=<?= $row->id; ?>"><img src="../images/icons/details.gif" alt="" /></a>
<a href="index.php?sub=wijzigen&producten&overige&verwijder=<?= $row->id; ?>" onclick="return confirm('Zeker weten?')"><img src="../images/icons/verwijder.gif" alt="" /></a>
</td>
</tr>
<?php
}
$row = mysql_num_rows($query);
if($row < 1){
?>
<tr>
<td colspan="3"><i>Geen overige producten.</i></td>
</tr>
<?php } ?>
</table>
<?php
}
}
else{
?>
<table style="text-align:center;">
<tr>
<td><a href="index.php?sub=wijzigen&producten&overige"><b>Overige</b></a></td>
</tr>
</table>
<?php
}
}
}
elseif(isset($_GET['templates'])){
if(isset($_GET['toevoegen'])){
if($_POST['toevoegen']){
if(!$indicatie){ $fout .= "- Indicatie ongeldig.<br />"; }
if(!$onderwerp){ $fout .= "- Onderwerp ongeldig.<br />"; }
if(!$bericht){ $fout .= "- Bericht ongeldig.<br />"; }
if(isset($fout)){
echo "<p>$fout</p>";
echo "<input type=\"button\" onclick=\"history.go(-1);\" value=\"Ga terug\" />";
} else {
$query = "INSERT INTO `templates` (`indicatie`, `onderwerp`, `bericht`) VALUES ('$indicatie', '$onderwerp', '$bericht')";
mysql_query($query);
echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1; URL=index.php?sub=wijzigen&templates\">";
echo "<p>Succesvol toegevoegd.</p>";
}
}
else{
?>
<form method="post" action="index.php?sub=wijzigen&templates&toevoegen">
<table>
<tr>
<td width="25%"><b>Indicatie:</b></td>
<td width="75%"><input type="text" name="indicatie" /></td>
</tr>
<tr>
<td><b>Onderwerp:</b></td>
<td><input type="text" name="onderwerp" /></td>
</tr>
<tr>
<td valign="top"><b>Bericht:</b></td>
<td><textarea name="bericht" cols="50" rows="5"></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Toevoegen" name="toevoegen" /></td>
</tr>
</table>
</form>
<?php
}
}
elseif($_GET['details']){
if($_POST['wijzigen']){
if(!$indicatie){ $fout .= "- Indicatie ongeldig.<br />"; }
if(!$onderwerp){ $fout .= "- Onderwerp ongeldig.<br />"; }
if(!$bericht){ $fout .= "- Bericht ongeldig.<br />"; }
//
if(isset($fout)){
echo "<p>$fout</p>";
echo "<input type=\"button\" onclick=\"history.go(-1);\" value=\"Ga terug\" />";
}
else{
$query = "UPDATE `templates` SET `indicatie` = '$indicatie', `onderwerp` = '$onderwerp', `bericht` = '$bericht' WHERE `id` = '$details' LIMIT 1";
mysql_query($query);
//
echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1; URL=index.php?sub=wijzigen&templates\">";
echo "<p>Succesvol gewijzigd.</p>";
}
}
else{
$query = mysql_query("SELECT `indicatie`, `onderwerp`, `bericht` FROM `templates` WHERE `id` = '$details' LIMIT 1");
while($row = mysql_fetch_object($query)){
?>
<form method="post" action="index.php?sub=wijzigen&templates&details=<?= $details; ?>">
<table>
<tr>
<td width="25%"><b>Indicatie:</b></td>
<td width="75%"><input type="text" name="indicatie" value="<?= $row->indicatie; ?>" /></td>
</tr>
<tr>
<td><b>Onderwerp:</b></td>
<td><input type="text" name="onderwerp" value="<?= $row->onderwerp; ?>" /></td>
</tr>
<tr>
<td valign="top"><b>Bericht:</b></td>
<td><textarea name="bericht" cols="50" rows="5"><?= $row->bericht; ?></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Wijzigen" name="wijzigen" /></td>
</tr>
</table>
<h1 class="titel">Voorbeeld</h1>
<p><?= nl2br($row->bericht); ?></p>
</form>
<?php
}
}
}
elseif($_GET['verwijder']){
if(!is_numeric($verwijder)){ $fout .= "- Verwijder ID ongeldig.<br />"; }
//
if(isset($fout)){
echo "<p>$fout</p>";
echo "<input type=\"button\" onclick=\"history.go(-1);\" value=\"Ga terug\" />";
}
else{
$query = "DELETE FROM `templates` WHERE `id` = '$verwijder' LIMIT 1";
mysql_query($query);
//
echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1; URL=index.php?sub=wijzigen&templates\">";
echo "<p>Succesvol verwijderd.</p>";
}
}
else{
?>
<p><a href="index.php?sub=wijzigen&templates&toevoegen"><b>Template toevoegen</b></a></p>
<table>
<tr>
<td width="85%"><b>Indicatie</b></td>
<td width="15%"><b>Details</b></td>
</tr>
<?php
$query = mysql_query("SELECT `id`, `indicatie` FROM `templates` ORDER BY `id` DESC");
while($row = mysql_fetch_object($query)){
?>
<tr onmouseover="this.bgColor='<?= $config['tabel_bg']; ?>'" onmouseout="this.bgColor=''">
<td><?= $row->indicatie; ?></td>
<td>
<a href="index.php?sub=wijzigen&templates&details=<?= $row->id; ?>"><img src="../images/icons/details.gif" alt="" /></a>
<a href="index.php?sub=wijzigen&templates&verwijder=<?= $row->id; ?>" onclick="return confirm('Zeker weten?')"><img src="../images/icons/verwijder.gif" alt="" /></a>
</td>
</tr>
<?php
}
$row = mysql_num_rows($query);
if($row < 1){
?>
<tr>
<td colspan="2"><i>Geen templates.</i></td>
</tr>
<?php } ?>
</table>
<?php
}
}
elseif(isset($_GET['korting'])){
if(isset($_GET['toevoegen'])){
if($_POST['toevoegen']){
if(!$code){ $fout .= "- Code ongeldig.<br />"; }
if(!is_numeric($bedrag)){ $fout .= "- Bedrag ongeldig.<br />"; }
if(!is_numeric($procent)){ $fout .= "- Procent ongeldig.<br />"; }
if($bedrag > 0 && $procent > 0){ $fout .= "- U dient slechts 1 type korting per code in te stellen.<br />"; }
if($bedrag <= 0 && $procent <= 0){ $fout .= "- Bedrag en/of procent ongeldig.<br />"; }
if(!is_numeric($minimaal)){ $fout .= "- Minimaal aankoopbedrag ongeldig.<br />"; }
//
if(isset($fout)){
echo "<p>$fout</p>";
echo "<input type=\"button\" onclick=\"history.go(-1);\" value=\"Ga terug\" />";
}
else{
$query = "INSERT INTO `korting` (`code`, `bedrag`, `procent`, `minimaal`, `eenmalig`) VALUES ('$code', '$bedrag', '$procent', '$minimaal', '$eenmalig')";
mysql_query($query);
//
echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1; URL=index.php?sub=wijzigen&korting\">";
echo "<p>Succesvol toegevoegd.</p>";
}
}
else{
?>
<form method="post" action="index.php?sub=wijzigen&korting&toevoegen">
<table>
<tr>
<td width="35%"><b>Code:</b></td>
<td width="65%"><input type="text" name="code" /></td>
</tr>
<tr>
<td><b>Korting:</b></td>
<td>€ <input type="text" name="bedrag" size="5" value="0.00" /> of <input type="text" name="procent" size="5" value="0" /> %</td>
</tr>
<tr>
<td><b>Minimaal aankoopbedrag:</b></td>
<td>€ <input type="text" name="minimaal" size="5" value="0.00" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><b>Eenmalig:</b></td>
<td>
<select name="eenmalig">
<option value="0">Nee</option>
<option value="1">Ja</option>
</select>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Toevoegen" name="toevoegen" /></td>
</tr>
</table>
</form>
<?php
}
}
}
else{
?>
<table style="text-align:center;">
<tr>
<td width="50%"><a href="index.php?sub=wijzigen&producten"><b>Producten</b></a></td>
<td width="50%"><a href="index.php?sub=wijzigen&templates"><b>Templates</b></a></td>
</tr>
<tr>
<td><a href="index.php?sub=wijzigen&korting"><b>Kortingen</b></a></td>
</tr>
</table>
<?php } ?>
Toon Meer