How Google works. Finding words with additional operators
What is a guest book?
Of course, here we are talking about the most typical guest book. First of all, this is a system that provides the user with the ability to enter text, select an assessment of a particular site, and also to specify their own data (name, e-mail, http, etc.). It is also a system for presenting data entered by various users, with the ability to navigate, send emails to the authors of the messages. There are also variations with different settings and with the control of normative vocabulary.
What do we need
Of course, it is assumed that the reader is familiar with the basics of ASP and SQL programming (familiarity with the first parts of this article will be quite enough for this). In addition, we need Microsoft SQL Server 7.0 or 2000, some HTML or text editor (I recommend using Macromedia Dreamweaver UltraDev 4.0) and a little patience.
Creating and preparing a database
To organize the storage of data entered by users, you need one table where you can create fields for storing the user's name, his email address, country of residence, site address, IP address, site user rating value on a five-point scale, etc.:
In order to easily integrate the system into existing sites, it is recommended to plan another table for storing color and other settings. This will allow you to change the specified settings in the future without changing the corresponding parameters in the source texts of the guestbook application modules.
- Run the Data Sources ODBC Configurator - Start->Settings->Control Panel->Administrative Tools->Data Sources ODBC.
- Go to the System DSN tab and create a new data source by clicking on Add…
- In the list of drivers that appears, select the database driver - Microsoft SQL Server and click Next.
- In the Data Source Name line, specify the name of your database (in the described example, Gustbook is the name by which you will refer to it in the future).
- In the Server line, specify the server to which the connection will be made, and click Next.
- Select the authentication mode With SQL Server…, set the username and password to connect to the SQL server; define the protocol for communication with the server (button Client Configuration - TCP/IP) and click Next twice, then click Finish.
- You will see statistics about the actions taken, and you can use the Test Data Source button to check the data source.
- As a result, you will see a line in the list of data sources in your system.
Now that the database is ready, you can proceed directly to creating a guest book.
Integration of the system into a ready-made website
It is clear that the guestbook itself does not make sense. Judge for yourself: who needs a site designed solely to collect the opinions of readers. After all, in order to collect opinions about something, you must first present this something to their judgment. Therefore, it is necessary to pay special attention to the issues related to the simplification of embedding the system into ready-made sites.
In particular, to make it easier to customize the system for the characteristic features of a particular site, it is recommended (as mentioned above) to create a special table to store all these preferences in order to enter certain values specific to your site into it. The obvious advantage of this approach is that in order to embed the system into an already finished site, you do not need to make changes in the source code of the modules, you only need to change the settings in the corresponding database table.
Imagine an example of the implementation of such a table: .
As you can see, there are fields for storing information about the name and password for accessing the system setup mode, about the colors of the main background of the user message, the top and bottom frames (Mid_Color, Top_Color, Bot_Color fields, respectively), about the color and size of the header of the form used for entering user data (Form_Color and FormTitleSize fields, respectively), about the color, size and style of the font of the text of the message itself, information fields, as well as the guestbook pages themselves (fields MessageFontColor, MessageFontSize, MessageFontFace, InfoFontColor, InfoFontSize, InfoFontFace, PageFontColor, PageFontSize and PageFontFace respectively), switch fields to enable the automatic sending of notifications of new messages by e-mail to the responsible person (for example, the manager or site administrator), fields for storing the e-mail address of the responsible person, the text of the message with thanks for the message left by the user, with the list are not allowed x words and a switch for their filtering mode (if the latter is enabled, then the words in the list of invalid words will be automatically replaced in the message text with asterisks and thus control over the normativeness of the website text vocabulary will be exercised).
The development of the guest book integration system implies the organization of a Web interface for setting all the parameters we have considered (fields of the administration table).
Integration of the system into an already finished site in its pure form can create some difficulties both in the perception of the source text and in the future, if, for example, you need to temporarily disable the guest book on a particular site. Therefore, we will try to develop a system in such a way that its integration into a finished site is not difficult. To do this, it is necessary to form an independent module of the system and include it in the text of the main site where necessary. So, for example, the text of your website page might look like this: