After a lot of revisions the script still has bugs. I attribute this mostly to the language barrier perhaps, because he looks like he knows some php :)
PhpQuick has been very helpful and patient with me but unfortunately I have to give up on this project.