The core of the system is written in PHP and is centred around two main scripts:
queries.php, which runs and returns queries on the main database and multishop.php,
which executes search queries across single or multiple XML databases. The following is
a description of how these scripts work, from top to bottom.
4.2.2 queries.php
The queries script handles forms submitted by users, translates them into MySQL queries
which it then runs on the MySQL database, before returning the results in HTML to the
Apache server, which sends them out to the user`s browser window. Many of the larger
chunks of code are split into separate files which are then included and evaluated inline
by PHP, with a command of the form: include( filename.inc ). The first step taken by
the script is to check whether it has been requested with or without a HTTP query string
the web equivalent of parameters to a function, not to be confused with an SQL query. If
there is no query string, just the search form and a welcome message will be returned,
formatted in HTML, prompting the user to enter some search criteria in the form
contained in form.inc. form.inc has a little PHP code to refill the elements of the form
with the contents of whatever query has just been made. Once a query has been made, the
HTML form sends its contents back around into the queries.php page in the form of a
HTTP query string.
A typical HTTP request would look like this:
http://localhost/queries.php?what=computer&searchby=location&where=malahide&your
area=01&radius=thisarea&sortby=default
This is how the request breaks down:
http:// the Hypertext Transfer Protocol, as distinct from ftp:// (File Transfer
Protocol), telnet:// (remote Unix login) , imap:// (Internet Mail Access Protocol) etc.
localhost/ the server name; could equally be
www.advancedgoldenpages.com
or
134.226.83.50.
queries.php the requested file, in this case a script that the Apache webserver will
recognise and execute through its PHP module.
? denotes the start of the HTTP query string, which contains the following variables
and their values, separated by ampersands
30