3
Probably the easiest way to do this is to create a simple module that has a block and a "landing page" to show the results.
You'll put the entry form in the block and then pass the results back to the landing page which will display the results (through your 'word' variable).
By the way, don't use this script "as-is" on anthing other than a localhost test site (not connected to anything) without first sanitizing the 'word' variable. As it is right now the script is vulnerable to SQL injection.
This could be done using a custom block and then something like a pagewrap module if you don't want to create your own module. I'd recommend you look at some of the Kaotik
documentation that will walk you through creating a simple module. From there you should be able to figure out how to customize it to include your code.
EDIT: You might want to consider going "all the way" and setting up the tables in the database and just use XOOPS to handle all of your connections, authentication, etc. You should be able to pretty easily import your existing data using phpMyAdmin (or similar application).