Monday, April 18, 2011

FINAL EXAM


5 / 5 / 2011


GOOD LUCK !!!!

CREATE A LOGIN PAGE

Set Up User Table and New Login Page

The first step to creating a login page is to make a table of users. To create this table, use the follow phpMyAdmin code:Dreamweaver - 1

Create Table users (username varchar(20) NOT Null default “,password varchar(20) NOT Null default “);

Next, open up Dreamweaver and open a new HTML page, titled “login.php”. Connect this page to your database. If your connection is successful, the application window should show the details of your table. While you are still in the “login.php” page, locate the word “Common” on your top navigation bar. When “Common” is clicked, a drop down menu will appear. From this menu, select “Application”. Next, select the last icon on the navigation bar and click “Log In User”.

Complete Login Table Fields

When “Log In User” is selected, a pop-up box will appear that allows you to fill in the details of your website login form. The firstDreamweaver - 2 section of the pop-up box will have you fill in basic information about your login page. The second section will have you fill in details about your database. The third section will act as a redirection based on the table structure of your database.

If a successful connection is made between your login page and database, this information will be displayed in the “Validate using connection” area. The last section of the pop-up box titled “Restrict access based on”, should have the choice “Username and password” checked only. Once you are finished completing the form, click “OK”.

Check the Script and Save to Computer

To check to see if your script is in the proper place, go to “Applications” and then click the link titled “Server Behaviors”. Your scriptDreamweaver - 3 name should be found in this panel. To edit this script anytime, simply double click. Save the “login.php” file to your computer, then upload to your website. Re-check the database to be sure that all information entered was correct.



USING DELETE AND UPDATE BEHAVIORS

Apply a behavior

You can attach behaviors to the entire document (that is, to the tag) or to links, images, form elements, and several other HTML elements.

The target browser you select determines which events are supported for a given element.

You can specify more than one action for each event. Actions occur in the order in which they’re listed in the Actions column of the Behaviors panel, but you can change that order.

  1. Select an element on the page, such as an image or a link.

    To attach a behavior to the entire page, click the tag in the tag selector at the lower-left corner of the Document window.

  2. Choose Window > Behaviors.
  3. Click the Plus (+) button and select an action from the Actions menu.

    Actions that are dimmed in the menu can’t be chosen. They may be dimmed because a required object doesn’t exist in the current document. For example, the Control Shockwave or Flash action is dimmed if the document contains no Shockwave or Flash SWF files.

    When you select an action, a dialog box appears, displaying parameters and instructions for the action.

  4. Enter parameters for the action, and click OK.
    All actions provided in Dreamweaver work in modern browsers. Some actions do not work in older browsers, but they will not cause errors.
    Note: Targeted elements require a unique ID. For example, if you want to apply the Swap Image behavior to an image, the image requires an ID. If you don’t have an ID specified for the element, Dreamweaver automatically specifies one for you.
  5. The default event to trigger the action appears in the Events column. If this is not the trigger event you want, select another event from the Events pop‑up menu. (To open the Events menu, select an event or action in the Behaviors panel, and click the downward-pointing black arrow that appears between the event name and the action name.)

Change or delete a behavior

After attaching a behavior, you can change the event that triggers the action, add or remove actions, and change parameters for actions.

  1. Select an object with a behavior attached.
  2. Choose Window > Behaviors.
  3. Make your changes:
    • To edit an action’s parameters, double-click its name, or select it and press Enter (Windows) or Return (Macintosh); then change parameters in the dialog box and click OK.

    • To change the order of actions for a given event, select an action and click the Up or Down arrow. Alternatively, you can select the action and cut and paste it into the desired location among the other actions.

    • To delete a behavior, select it and click the Minus (–) button or press Delete.


    Update a behavior

    1. Select an element that has the behavior attached to it.
    2. Choose Window > Behaviors and double-click the behavior.
    3. Make your changes and click OK in the behavior’s dialog box.

      All occurrences of that behavior in that page are updated. If other pages on your site have that behavior, you must update them page by page.

Go to Detail Page & Go To Related Page

Create a link to open a related page (ASP, JSP)

You can create a link that opens a related page and that passes existing parameters to that page. The server behavior is only available when using the ASP or JSP server models.

Before adding a Go To Related Page server behavior to a page, make sure the page receives form or URL parameters from another page. The job of the server behavior is to pass these parameters to a third page. For example, you can pass search parameters received by a results page to another page and save the user from entering the search parameters again.

Also, you can select text or an image on the page to serve as the link to the related page, or you can position your pointer on the page without selecting anything, and the link text is inserted.

  1. In the Go To Related Page box, click Browse and locate the related page file.

    If the current page submits data to itself, enter the current page’s file name.

  2. If the parameters you want to pass were received directly from an HTML form using the GET method, or are listed in the page’s URL, select the URL Parameters option.
  3. If the parameters you want to pass were received directly from an HTML form using the POST method, select the Form Parameters option.
  4. Click OK.

    When the new link is clicked, the page passes the parameters to the related page using a query string.


Find and display the requested record on the detail page

In order to display the record requested by the master page, you must define a recordset to hold a single record and bind the recordset columns to the detail page.

  1. Switch to the detail page. If you don’t have a detail page yet, create a blank page (File > New).
  2. In the Bindings panel (Window > Bindings), click the Plus (+) button and select Recordset (Query) or DataSet (Query) from the pop‑up menu.

    The simple Recordset or DataSet dialog box appears. If the advanced dialog box appears instead, click Simple.

  3. Name the recordset, and select a data source and the database table that will provide data to your recordset.
  4. In the Columns area, select the table columns to include in the recordset.

    The recordset can be identical to or different from the recordset on the master page. Usually a detail page recordset has more columns to display more detail.

    If the recordsets are different, make sure the recordset on the detail page contains at least one column in common with the recordset on the master page. The common column is usually the record ID column, but it can also be the join field of related tables.

    To include only some of the table’s columns in the recordset, click Selected and choose the desired columns by Control‑clicking (Windows) or Command-clicking (Macintosh) them in the list.

  5. Complete the Filter section as to find and display the record specified in the URL parameter passed by the master page:
    • From the first pop‑up menu in the Filter area, select the column in the recordset containing values that match the value of the URL parameter passed by the master page. For example, if the URL parameter contains a record ID number, select the column containing record ID numbers. In the example discussed in the previous section, the recordset column called CODE contains the values that match the value of the URL parameter passed by the master page.

    • From the pop‑up menu beside the first menu, select the equal sign (it should already be selected).

    • From the third pop‑up menu, select URL Parameter. The master page uses a URL parameter to pass information to the detail page.

    • In the fourth box, enter the name of the URL parameter passed by the master page.

  6. Click OK. The recordset appears in the Bindings panel.
  7. Bind the recordset columns to the detail page by selecting the columns in the Bindings panel (Window > Bindings) and dragging them onto the page.

    After uploading both the master and detail pages to the server, you can open the master page in a browser. After clicking a detail link on the master page, the detail page opens with more information about the selected record.

MAKE A CONNECTION TO DATABASE FILE

To make a connection to database in dreamweaver, firstly, you must create a new site. Remember that your site must be saved in folder 'htdocs', and database saved in mysql (for PHP). For ASP, site must be saved in folder 'project/other name' inside folder wwwroot and database save in 'data'.



How to make a Guestbook in Dreamweaver


1. Create new databases using Ms.Access (asp) or phpmyadmin (php).

2. Make a new site in dreamweaver.
- go to site > new site > name your site > choose server technology (ASP vbscript/php mysql)
- choose folder to store your files
- test URL

3. Connecting to a database file.
- Click on the plus (+) and select custom connection string at database tab in application
property.
- type connection name and string.
- testing server

4. Create a register page





5. Inserting data to a database (using recordset)

Open the "MySQL Connection" window
Open the "MySQL Connection" window
  • Configure the MySQL Connection window by giving the connection name of your choice, the MySQL server name, user name and password (if available) and then select a database existent on the server; as the server I am using runs on the local machine I inserted localhost with the default user root and no password. Also, I have previously created a database entitled test with a table inside.

Configure the "MySQL Connection" window

Configure the "MySQL Connection" window

Select the desired database

Select the desired database

  • By accessing Window>Bindings or by pressing Ctrl+F10, open the Bindings panel. By using the plus-like icon, create a Recordset (Query).

Open the "Recordset" window

Open the "Recordset" window

  • Configure the recordset in the Recordset window; you have to give it a name, to select a connection with a database (or click on Define to create a new one), to select a table from the database and define a query. Click on Test to see how the table content is displayed.

Configure the "Recordset" window

Configure the "Recordset" window


INTRODUCTION TO PHP (MYSQL)

What is PHP?

  • PHP stands for PHP: Hypertext Preprocessor
  • PHP is a server-side scripting language, like ASP
  • PHP scripts are executed on the server
  • PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.)
  • PHP is an open source software
  • PHP is free to download and use
  • PHP runs on different platforms (Windows, Linux, Unix, etc.)
  • PHP is compatible with almost all servers used today (Apache, IIS, etc.)
  • PHP is easy to learn and runs efficiently on the server side
What is MySQL?
  • MySQL is a database server
  • MySQL used to store, sort, arrange, and display information.
  • MySQL is ideal for both small and large applications
  • MySQL supports standard SQL
  • MySQL compiles on a number of platforms
  • MySQL is free to download and use
Where to Start?

To get access to a web server with PHP support, you can:

  • Install Apache (or IIS) on your own server, install PHP, and MySQL
  • Or find a web hosting plan with PHP and MySQL support

PHP MyAdmin


phpMyAdmin is an open source tool written in PHP intended to handle the administration of MySQL over the World Wide Web. It can perform various tasks such as creating, modifying or deleting databases, tables, fields or rows; executing SQL statements; or managing users and permissions.


Steps to create a database in PHPMyAdmin

  1. The following figure shows your PHPMyAdmin interface, just enter your database name and click the 'Create' button to create your database.



  2. Now to create a new table enter your tablename and the number of fields in the table, then click the 'Go' Button.



  3. The next step is to create the fields, just enter values for each field name, type, length of the field, null option and mention whether it is a primary key or not. Then click the 'Save' button to complete your table creation.



  4. The following figure is displayed upon successful creation of your table:


Saturday, April 16, 2011

INTODUCTION TO ASP (ACTIVE SERVER PAGES)

INSTALLING IIS ON WINDOWS XP

  1. On the Start menu, click Control Panel.
  2. Double-click Add or Remove Programs.
  3. Click Add/Remove Windows Components.
  4. Click Internet Information Services (IIS) and then click Details.

http://www.petri.co.il/images/inst_iis_xp.gif
  1. In Internet Information Services (IIS), select the check boxes for SMTP Service and World Wide Web Service, and then click OK.
http://www.petri.co.il/images/inst_iis_xp1.gif

  1. In Windows Component selection, ensure that the Internet Information Services (IIS) check box is selected, and then click OK to install the components that you selected.

INSTALLING IIS ON WINDOWS VISTA / 7

1. To open the Windows Features dialog box, click Start, and then click Control Panel.


2. In the Control Panel, click Programs.


3. Click Turn Windows features on or off.


4. You may receive the Windows Security warning. Click Allow to continue. The Windows Features dialog box is displayed.


5. Expand Internet Information Services. Additional categories of IIS features are displayed. Select Internet Information Services to choose the default features for installation.


6. Expand the additional categories displayed, and select any additional features you want to install, such as Web Management Tools.


7. If you are installing IIS 7 for evaluation purposes, you may want to select additional features to install. Select the check boxes for all IIS features you want to install, and then click OK to start installation.


8. The progress indicator appears.


9. When the installation completes, the Windows Features dialog box closes, and the Control Panel is displayed.


10. IIS 7 is now installed with a default configuration on Windows Vista or Windows 7. To confirm that the installation succeeded, type the following URL into your browser, http://localhost.



Sometimes, windows users always facing the same problem when installing IIS on their computer. Here are the solution for problems in Microsoft Windows.

1. Open Windows Explorer > click tools > folder options > activate view tab.
2. Then deactivate Use simple file sharing (recommended) options.
3. click ok.
4. Open your inetpub folder at c:\Inetpub\wwwroot\folder using windows explorer.
5. Right click at the folder that holds the access database file and click at properties.
6. Click at security tab and click add button > then click advanced button.
7. Click at find now button and choose everyone.Click ok.
8. Then activate write options for everyone user.
9.Click ok .


CREATE A CONTACT FORM IN DREAMWEAVER CS3 USING ASP


1. Create a new site in Dreamweaver CS 3. Save the new site in c:\inetpub\wwwroot\project.

2. Create a database in Access and save the database in the folder c:\inetpub\wwwroot\data. The database must save in MS Access 2002-2003 with .mdb file extension

3. create a table in database and create the following fields:


i) name1

ii) username

iii) password

iv) remarks

4.For remarks field, choose Memo as its data type.


5. Then create connection in Dreamweaver CS 3. Open the database panel, click at + button, select Custom Connection String. Enter a name for the connection as dmx. Enter the connection string as "Driver={Microsoft Access Driver (*.mdb)};DBQ="& Server.MapPath("/data/guest.mdb"). click test to connect to the database and then click ok.

6. Create a new ASP VBScript page. Insert a form. Insert a table and insert the text and text field.

7. Give the name to the text field in Properties panel.

8. Save the page as daftar.asp in c:\inetpub\wwwroot\project

9. Then set the Insert Record to write data into database. Click Active Server Behaviors tab. Click the + button then select Insert Record, select the connection that you gad created then click ok. Save the file.


10. Create a new ASP VBScript page. Save the file as view.asp.

11. Create the text and text field for name, username, password and remarks.

12. Click Server Behaviors tab. Click the + button, select RecordSet. Select the connection that you had created. Select sort: name1 and Ascending to sort the data for viewing. Click test.

13. Activate Bindings tab. Click + button select RecordSet. Click at + button sign in front of the RecordSet and you can see all the fields in the database.

14. Drag nama into cell 1 in column 2 in the table that you create in view.asp. drag other fields also into the following cell in column 2. Draw a line below the table. Next highlight the table including the line below the table. Click the + button on the panel, select Repeat Region. Click ok.

15. Open back your daftar.asp file. Double click Insert Record behavior in Server Behavior and add view.asp in After inserting go to: click ok.

16. Click at Preview in Browser icon. Type any data and click save button. Automatically the view.asp file will be displayed and you can see the data that you typed.