heey iedereen,
ik ben met iets leuks bezig(vindt ik zelf)
en ga dat uiteindelijk gratis online zetten.
maar nu loop ik tegen een probleem.
zie:
zoals je ziet, niet bepaald veilig.
er komt bij de $_POST nog mysql_real_escape_string() bij maar dat is nu nog even niet belangrijk.
en misschien kan ik beter een isset gebruiken bij de if en elseif
mijn vraag is dus nu: Waarom UPDATE hij de tabel niet?
aan de config kan het niet liggen want ik kan wel toevoegen
ik hoop dat iemand het weet(vast wel)
groeten
ik ben met iets leuks bezig(vindt ik zelf)
en ga dat uiteindelijk gratis online zetten.
maar nu loop ik tegen een probleem.
zie:
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// hier include hij de config[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #DD0000]config.php[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]// haal de id uit database om te bewerken[/COLOR]
[COLOR= #0000BB]$haal[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_GET[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM tabel WHERE id=$haal"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700])) {[/COLOR]
?>
<h2>Bewerk bericht</h2>
<form method="post" action="">
<table width="100%">
<tr>
<td align="left">Door</td>
<td align="left"><input name="naam" id="Naam" value="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Naam[/COLOR][COLOR= #007700]];[/COLOR] ?>" /></td>
</tr>
<tr>
<td align="left">Bericht:</td>
<td align="left"><textarea name="bericht" rows="10" cols="20" id="Bericht"/>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]Bericht[/COLOR][COLOR= #007700]];[/COLOR] ?></textarea></td>
</tr>
<tr>
<td align="left"><input type="submit" name="submit" value="Bewerk" /></td>
</tr>
</table>
</form>
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]]))
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"geen naam"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]))
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"geen bericht"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE tabel
SET
Bericht = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]",
Naam = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]naam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]",
NOW()
WHERE id = $haal"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Bericht Succesvol bewerkt!"[/COLOR][COLOR= #007700];
}[/COLOR]
?>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?> zoals je ziet, niet bepaald veilig.
er komt bij de $_POST nog mysql_real_escape_string() bij maar dat is nu nog even niet belangrijk.
en misschien kan ik beter een isset gebruiken bij de if en elseif
mijn vraag is dus nu: Waarom UPDATE hij de tabel niet?
aan de config kan het niet liggen want ik kan wel toevoegen
ik hoop dat iemand het weet(vast wel)

groeten
