Here is the second step. It is the form to mass change sections of notes. I think that moving Nuno's script to the server is not necessary. It can be easily run locally and through the web interface only changes can be done.
Then do a select on the notes db and check for non-valid IDs and do a foreach{} to print a html form to allow us to change the IDs.
The interface should be more universal to allow changes of notes in e.g. split sections.
Jakub, I have committed your patch. It would be good if you could review your code and fix the same errors you have fixed in the previous magic_quotes/register_globals patch - since you submitted this patch before the cleanup.
Thanks, Goba