[Mediawiki-l] Problem with wiki database editing

Hendrik Brummermann HendrikUsenet at nexgo.de
Sat Jan 7 08:57:07 UTC 2006


Hi edward,

although Rob Church answered your question, I have two additinal comments.

edward wrote:
> $newtitle = "dive-entry-12";
> $text = "dit is een blob hoop ik!!";
> $sql1 = "insert into text (old_text, old_flags) values ($text, \"utf-8\")";

Please read [[SQL Injection]].

> $sql2 = "select max(old_id) from text"; // result = $page_latest

This is a [[Race Condition]]. Please use $dbw->insertId() (in MediaWiki)
or mysql_insert_id for MySQL databases outside of MediaWiki.

Hendrik



More information about the MediaWiki-l mailing list