Preparation: Install the ASP Server (IIS or PWS) + ACCESS (which comes with Windows ). To avoid any problems, we recommend that you follow the steps described in the course. Now, the preparation is complete. Next we will introduce in detail the steps: What should a message board have? Including: Visitor Name and visitor Homepage)
Preparation: Install the ASP Server (IIS or PWS) + ACCESS (which comes with Windows ). To avoid any problems, we recommend that you follow the steps described in the course. Now, the preparation is complete. Next we will introduce in detail the steps: What should I do with a message version? Including: Visitor Name and visitor Homepage)
Preparation: Install the ASP Server (IIS or PWS) + ACCESS (which comes with Windows ). To avoid any problems, we recommend that you follow the steps described in the course. Now, the preparation is complete. Next we will introduce the steps in detail:
One
MessageWhat should the version contain? Visitor name (
Name), Visitor homepage (
Hpage), Visitor QQ (
QQ), Visitor mailbox (
Email), Guest image (
ICON),
,
MessageContent (
Ctent),
MessageTime (
Date) -- This is the visitor's information. Moderator reply (
Rply) And, the moderator's management account: User Name (
Username), Password (
Pwd). To save so much information, you must have a database.
Design? Visitor's
MessageThe management account of the moderator remains unchanged. Therefore, the two tables should be separated to save
MessageAnd the visitor's information, and the other stores the moderator's management account. Okay,
Now you can start
DesignDatabase. Open ACCESS (available in Microsoft Office software) and create a blank database. ACCESS will prompt you to save the database and locate your
MessageFolder (I created
GuestbookFolder), save
Data. mdb.
Database settings:
ID: set as the primary key to determine data uniqueness to ensure that the corresponding records can be accurately located during management
Name: Set the field size to 15 (the Name is not so long)
Email: The field size is 20 (the length of the Email address)
ICON: The field size is 255.
Hpage: The field size is 30 (many friends are still using second-level or third-level domain names, so relax a little)
Date: The default value is Now () (the system time when a new record is inserted with Now)
When the table window is closed, the system prompts whether to save the changes to the table. Select "yes", change the table name to main, and create the table admin to save the management account:
You also need a table that records the IP address. Click here to download the table and open the database data. mdb, select "Get external data> Import" under the "file" menu, select the database you just downloaded in the pop-up dialog box, import, select
AddressTable, OK. Now the database data. mdb should have the following three tables:
Up to now, all the database work has been completed. The program has been configured. Check the database carefully and make no mistakes.
In the IIS (Internet Information Service) installation method, we define the site root directory in IIS in D: asp. Now we enter this directory to create a new folder and name it guestbook.
Click "Next" to continue the next step.
VBScriptASP for script:
Click "Next" to continue with the site folder settings. Because we are testing locally and the guestbook folder is in D: aspguestbook, the settings are as follows:
Click "Next" to continue the next step.
DreamweaverTest URL:
Click "Next" to continue the next step. Because we are testing on the local machine and do not require remote server participation, select "no ":
Click "Next" to continue the next step. Here, the information we just filled in is displayed to confirm. If any error is found, click "previous" to return to the modification settings, after confirming that the website is correct, click "finish" to complete the website definition.
In
DreamweaverCreate a new page (in the "new" New Document dialog box"
ASP VBScript"Type document), save as index. asp, and modify the page title"
MessageBoard Homepage"
Click the insert table icon in the common tool group to insert a table (marked as table 1) with five rows and one column. The settings are as follows:
Select the table and set it to center and align in the properties panel:
Move the cursor to the cell in the third row, insert tables in two columns into the split cells, and align them vertically at the top of the center. Split the table with two rows of cells and insert an Avatar (the Avatar path is
MessageUnder the Board directory
Images/iconAnd then set the horizontal alignment of the two cells to center. There is only one large blank cell left, which is used to display the visitor.
MessageAnd the area of the visitor data, insert a table 100% (marked as table 2) with three rows and one column in this cell, write the text, set the horizontal alignment mode, and after the cell height, insert a new display
MessageTwo rows and two columns of the content and the reply content (marked as table 3) are written into a unique blank cell, text is written and set, and finally"
Message"," View ", and" management "are separated by links (method: select the text and enter the link address in the" Link "input box on the property panel)
Insert. asp, index. asp, login. aspEffect after completion
Till now,
MessageAll the work of the table is completed. Next section: connect to the database.
Open the server behavior panel by window and check whether there is a check mark before the first three items in the four items. If not, the corresponding items are not set in the site definition.
Create a record set if "Dreamweaver website definition" is performed. Click "+" on the server behavior Panel because we have not connected to the database, therefore, you also need to define the database connection string. Click "Custom connection string" in the pop-up menu of the database,
Now is the most critical step. Fill in the connection name in the "Custom connection string" dialog box
Liu, (The connection name is your own) connection string:
"DRIVER = {Microsoft Access Driver (*. mdb)}; DBQ = D: aspguestbookdata. mdb"Please fill in carefully and there will be no error. Pay attention !!! After adding a good test, the software automatically generates asp files connected to the database and asp files.
ConnectionsFolder
Liu. asp.
Create a record set, click it to bind it to the menu, and select a record set as follows,
The database connection is complete. Next Step: Data bundling.
We associate the Avatar address with the data in the database, that is, binding
ICONField data to the image:
This completes the Avatar binding, OK, do not stop, continue binding
NameField to the "guest nickname" under the Avatar ":
1) Select "guest nickname" and then press (BIND) the Panel
2) Select
NameClick the "bind" button below the field,
Similarly
NameBind the field to "guest" posted on 4:04:49,
DateBind the field to "guest posted on
2003-9-27
4:04:49"
In,
CtentBind"
MessageContent "and Rply are bound to" Reply content ". After" Reply content ", open the Code view and add
Line feed, and then bind
Set
RateField.
Take a closer look, as if there are "Homepage", "Mailbox" and "QQ" not bound data. According to our plan, these three groups of texts should all contain links, and the link address is bound to the information entered by the visitor. In fact, this method is similar to the method used to bind the Avatar:
1) Select "Homepage" and click "Link" folder in the property Panel. In the displayed "window" dialog box, click "OK ", return to the property panel and select "_ blank" as the target value to open the guest homepage in a new window.
2) Similarly, the "Mailbox" link should be added before the mailbox link"
Mailto:"
3) the link for "QQ" is slightly different from the previous one, because the address for viewing QQ user information is
Http://search.tencent.com/cgi-bin/friend/user_show_info? Ln =* *****, So we need to replace the asterisk with the data in the "QQ" field,
Now all the data is bound.
MessageThe Board will always display only one
MessageRecord, so we also need to set the repeated domain and flip
1) move the cursor to the cell where the Avatar is located, and click
,
2) Click expand server behavior panel, click "+", and select "Duplicate region" from the drop-down menu that appears. The default settings are used here, so click "OK"
3) Select Table 2, and then click server behavior "show Region". point: if the record set is not empty, the area is displayed.
This is to avoid errors when the database does not have records. I believe that the first item "show the region if the record set is empty" is also noticed ", this can set the content displayed when the database has no records.
When there are more data records, they cannot be displayed on one page.
MessageThe page flip function is added. Select "Homepage" to open the server behavior panel,
Click the "+" icon above, and select "record set page-Move to the first record" from the drop-down menu ", similarly, the "previous", "Next", and "last" pages are added with the page flip function, the corresponding server behavior is "Move to the previous record", "Move to the next record", and "Move to the last record". By the way, there is also a direct insert record set navigation bar, you can try the difference with what we just did. Finally, remember to set "record set pagination" for the navigation bar application. If there is no record, page turning is unnecessary.
Our
MessageThe homepage is complete. You can test it. in IE, enter "http: // localhost/guestbook/index. asp" to check the labor result... What? Nothing? Haha !! There is no data in your database. How about adding it to your database? Succeeded!
Create a new one named:
Insert. aspFile, select the form icon in the form to create a new form, then select the table icon in common use, insert a table with five rows and four columns in the form, adjusted, and add the corresponding words,
Add form field: Name: Add a text field to the table corresponding to the name.
NameTo match the field name of the database.
Mailbox: Add a text field to the table corresponding to the mailbox and name it on the Properties panel
EmailTo match the field name of the database.
Home page: Add a text field to the table corresponding to the home page and name it on the property panel
HpageTo match the field name of the database.
QQ: Add a text field to the table corresponding to QQ and name it on the property panel
QqTo match the field name of the database.
Avatar: insert the user avatar image in the corresponding cell, and then add the corresponding radio button to name it:
Tx
MessageContent: In
MessageAdd the text area to the cell corresponding to the content and change it to Ctent in the property panel. All the added form fields,
Define the server behavior of the submit button: select the entire table, open the server behavior panel, and click the "+" button to select the insert record under the menu
Set the one-to-one correspondence between form fields and database Field Names, select the elements in the form elements in sequence, and select the fields corresponding to the database in the column below.
Define form submission error check (behavior panel): Sign
MessageTo avoid writing error information, add the error check function for form submission. Open
DesignOn the behavior panel, click "+" and select Check Form
Add
MessagePage to achieve this, in
MessagePage to add
MessageCheck whether there are any records in the database.
MessageIs there any
Message, Please exercise more.
Management page
Index1. aspIn fact
MessageBoard Homepage
Index. aspFunction is similar, so you can directly save index. asp
Index
1. aspFirst, change "Access Management" to "exit management", and add the management function:
Delete, edit, and reply:
Add Server behavior: Open the server behavior panel under the application, click the "+" button to select restrict access to the page under user authentication:
Restrict page access dialog box settings. The administrator can enter the correct user name and password when logging on to the Management page. Otherwise, the Administrator will be redirected to the login. asp logon page.
Select the added logout management text, add server behavior, open the server behavior panel under the application, and click "+" to select the logout user under user authentication. This is a function added to exit management:
Unregister user settings. After the Administrator exits, the system jumps to the display page.
MessagePage
Index. asp.
Select the "edit" text, open the server behavior panel, click "+", select go to details page, open go to details page dialog box, details page select edit. asp, go to details page dialog box settings:
The URL parameter is
IdIt is the ID field type defined in the mdb database. The automatic number will not be repeated in the database. We will edit it in the future.
MessageAn entry in the Board
MessageThis
MessageThe ID number of the information is passed
Edit. aspPage,
Edit. aspThe page displays this
MessageThe information is edited by me. (That is
MessageIn the database, an id is recorded. Editing is based on the id of the Post)
Select "reply" and "delete" text respectively, open the server behavior panel in turn, click "+" and select go to details page to open the go to details page dialog box, select the "reply" details page
Huifu. aspOn the "delete" details page, select delete. asp. Go to details page dialog box settings.
Above
MessageThe page of the Board Management Section is complete.
New
Login. aspOn the administrator login page, you must first insert a form, insert a table into the form, and layout the table.
Add Server behavior: Open the server behavior panel under the application, and click "+" to select the login user under User Authentication
User Logon Settings: first select the data source in use link verification (here the data source name is
Admin), And then enter
Index1.asp(Management page). If logon fails, go to the following input box and enter
Login. asp(If the logon fails, go to the Administrator Logon page)
Save
Login. aspAnd then open
Data. mdbDatabase, open
AdminDatabase table, in
UsernameEnter a username (User name: Learning) under the field.
PwdEnter a user password (user password:
123456Can be written at will.
On the administrator login page
DesignFinished.
Create
Delete. aspTo delete a page, insert a form and add cells and form fields to the form.
On the binding panel, click "+" to select a record set. The record set dialog box is displayed.
Select the text field corresponding to the name, rename it to name in the attribute panel, and click the button to open the dynamic data dialog box, add dynamic data for the name text field, and select the name field in the record set, dynamic Data dialog box settings:
MessageThe method for binding content dynamic data is the same as that for name binding. You can bind content dynamic data according to the above method.
Add restricted access page behavior: Open the server behavior panel and click "+" to select restricted access to the page under user identity authentication. the restricted access to page dialog box is displayed, restrict page access dialog box settings,
Server behavior on the page: Open the server behavior panel, click "+" and select Delete record. The delete record dialog box is displayed.
The deletion record page is complete.
Create an administrator reply page: Create a huifu. asp reply page. Insert a form, add a table and a form field to the form, and insert a table with six rows and two columns:
The settings are as follows: add the red letter to the attribute
Bind record set: click "+" on the binding panel and select "add record set ".
Add dynamic data: name, EMAIL,
MessageContent and reply content: select the text field corresponding to the name and change it to name in the attribute panel. Then, click the button to open the dynamic data dialog box and add dynamic data for the name text field, select the name field in the record set and set it in the dynamic data dialog box:
The dynamic data binding method for other content is the same as the name binding method. You can bind the dynamic data binding method according to the above method.
Add restricted access page behavior: Open the server behavior panel and click "+" to select restricted access to the page under user identity authentication. the restricted access to page dialog box is displayed, restrict page access dialog box settings,
Server behavior on the page: Open the server behavior panel, click "+" and select an update record. The update record dialog box is displayed.
The reply page is edited.
Edit
Message(Update records) page creation:
MessageEdit an unreasonable part.
Create a file
Edit. aspEdit the page. First, add a form in the insert panel, add the table and form field in the form, and add the red letter to the attribute text field.
On the BIND panel, click "+" to select a record set. The record set dialog box is displayed:
Add dynamic data: name, EMAIL,
MessageContent and reply content: select the text field corresponding to the name and change it to name in the attribute panel. Then, click the button to open the dynamic data dialog box and add dynamic data for the name text field, select the name field in the record set and set it in the dynamic data dialog box:
OICQ, mailbox, personal homepage,
MessageThe method for binding content dynamic data is the same as that for name binding. You can bind content dynamic data according to the above method.
Add restricted access page behavior: Open the server behavior panel and click "+" to select restricted access to the page under user identity authentication. the restricted access to page dialog box is displayed, restrict page access dialog box settings,
Server behavior on the page: Open the server behavior panel, click "+" and select an update record. The update record dialog box is displayed.
MessageThe page of the Board Management Section is complete, and the whole
MessageThe board system is all done. This is done with DreamweaverMX.
MessageBoard system, combined with the front and back
DesignEnvironment, using ASP VBScript server-side scripting technology, rich functions, full of personality, especially you do not need to write a program code to achieve dynamic interaction function, so that users who do not understand the code can also learn to do ASP
MessageVersion.