Mailinglisten-Archive |
Ulrich Wiederhold wrote:
> Hallo,
> ich bekomme folgende Fehlermeldung:
>
> Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
> expecting T_STRING or T_VARIABLE or T_NUM_STRING in addphotos.php on
> line 270
wo ist Zeile 270??
> Die sql-Anweisung:
>
> foreach($result as $photo) {
>
> mysql_query("INSERT INTO photos (
> photo_titel,
> ...
> resolution)
> VALUES (
> '$photo['photo_titel']',
> ...
> '$photo['resolution']')
> ");
> } //foreach
1.
'...' . $photo['photo_titel'] . '...'
2. noch viel wichtiger !!!
'...' . mysql_real_escape_string( $photo['photo_titel'] ) . '...'
weil sonst "'" in deinen Strings die alles durcheinander hauen, und wenn
die Daten vielleicht sogar ungeprüft sind eine SQL-Einschleusung erlauben!!
http://faq.phpbar.de/index.php/Injection#SQL-Injection
--
Sebastian Mendel
www.sebastianmendel.de
www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet
php::bar PHP Wiki - Listenarchive