Monday, May 2, 2011

Week 16 - Study Week

Study Week...
Exam will be on 4th May..
Million thanks to Dr.Zaida for teaching us...
& Good Luck to all my friend...

week 15 - Using Delete & Update Behaviors

Using Delete & Update Behaviors
( appropriate for administrator page where the admin can delete certain users or updating information on users)


Before using Delete and Update behavior, we have to use the RecordSet behavior first.
Steps:
1. Create a page to view back the data of all the registered users. Insert form first OK.
2. Add a Delete and Updating buttons / texts in the page.
3. Use RecordSet and Repeat Region.
4. Create a Delete Page. In the Delete Page, view back the information of the user based on the RecordSet. Add a Delete button.
5. Use a Delete Behavior.
> Name of the form
> Name of the RecordSet
6. Highlight the Delete button / text and use Go To Detail Page or Go To Related Page behavior to link the asp file to the Delete Page to view back the detail information of the user.


For update behavior, continue these steps:
1. Create an Update Page. Insert form first OK.
2. Use RecordSet and Repeat Region.
3. In the Page, insert Text Field for each field.
4. View back the information of the user based on the RecordSet by arranging the behavior from Bindings into the related field:
5. Add an update button.
6. Use update behavior.
7. Highlight the Update button / text and use Go To Detail Page or Go To Related Page behavior to link the asp file to the update Page to view back the detail information of the user.

Week 14 - INTEGRATING SECURITY

Activity 1: Integrating Security into an Application


1. Create a form.
2. Create a table in a database.
3. Type a few username and password for testing.
4. Close your database file and view back your dreamweaver file.
5. Save the file. Make sure your connection is working.
6. Click Server Behavioes > User Authentication > Log In User
7. Select the correct form and connection.
8. Make sure you select the correct table and also the correct fields for username and password.
9. Select also the html or ASP file for If Login Succeeds and If Login Fails.
10. For Restrict Access Based, just select Username and Password.
11. Click OK. Test your application.
12. Try to create the Logout Page.


Activity 2: Integrating Security into an Application with Registration Page

1. Create a table in a database to hold all the data from the registration page. Don't forget to set a Premiary Key to the id variable or username variable.
2. The registration page should ask information such as Name, Username, Password.
3. Text Field for password has to set up as password.
4. Use Insert Record bahavior.
5. No need to view back the registration information. Therefore, don't use RecordSet bahavior.
6. Create another ASP file for login page.
7. Use Login Behavior and please use a same table (that holds registration information) for the username and password.

Activity 3: Go To Related Page and Go To Detail Page


1. Create a page to view back the data of all the registered users.
2. Use RecirdSet and Repeat Region.
3. Highlight one user and Go To Detail Page or Go To Related Page Behavior to link the asp file to the file that view back the detail information of the user.
4. Prepare the detailed file by viewing back the detail information of the user. Create another RecordSet and filter it based on it. Please use this new RecordSet.


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.

Week 13 - How to make a guestbook to using Dreamweaver...

Please click below address for the tutorial..


http://version2.andrewkendall.com/pages/learning/tutorials/phpandmysql/guestbook/2.setup_dreamweaver_site.php


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

Sunday, May 1, 2011

Week 12 - 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

WEEK 11 - PHP

PHP is a server-side scripting language.

What You Should Already Know

Before you continue you should have a basic understanding of the following:
  • HTML/XHTML
  • JavaScript
If you want to study these subjects first, find the tutorials on ourHome page.

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

What is a PHP File?

  • PHP files can contain text, HTML tags and scripts
  • PHP files are returned to the browser as plain HTML
  • PHP files have a file extension of ".php", ".php3", or ".phtml"

What is MySQL?

  • MySQL is a database server
  • 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

PHP + MySQL

  • PHP combined with MySQL are cross-platform (you can develop in Windows and serve on a Unix platform)

Why PHP?

  • PHP runs on different platforms (Windows, Linux, Unix, etc.)
  • PHP is compatible with almost all servers used today (Apache, IIS, etc.)
  • PHP is FREE to download from the official PHP resource: www.php.net
  • PHP is easy to learn and runs efficiently on the server side

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

PhpMyAdmin Tutorial

PhpMyAdmin is web base software used for creating and maintaining MySQL databases. This tutorial is designed to get you starting with the basics of phpMyAdmin.
You can access your MySQL account using phpMyAdmin using the link provided to you --something like below where my-domain.ca is your domain name
http://www.my-domain.ca/phpmyadmin/
When you click on the link above, a dialog box will prompt you for a username and password. This will be the username and password given you when we set it up for you.
Login screen
Once you log in, a phpMyAdmin screen appears as shown below.
phpMyAdmin welcome page
Creating a table in your database
The left-hand frame in phpMyAdmin is used for navigation.You will see your database displayed here (in this case called mydomain). As you create tables, they will show below this.
Click on your database the navigation frame and a new window will appear on the right hand side.
Creating a table
We will create a table in the database, called "people". Use the Create new table feature. Type in the name of the new table into the Name: people, and the number of columns in the table (4) into Fields:. This tutorial is only designed to show you the basic php/MySQL/phpMyAdmin functions. You can delete it using the Drop function. You will want to allow for growth in your table.
Defining fields
Click Go and you should see something like this. The table title now appears with under the database name.

table features
Now enter the names and attributes of our table fields. Enter the following information as above:







Field Type Length Default Extra
id int 6 0 auto_increment
name char 100

telephone char 50

birthday char 50

The Length value indicates the maximum allowable length of characters for input. There are many different values that can be set for Type; see further documentation here. The Types specified in this example aren't the most efficient, but just used for the purposes of this exercise. The "id" field, which will be used as a Primary key for this table, has been set to auto_increment, saving you from having to having to type in the next number in sequence when you input records. Set the Default to 0
Once you've entered all the values, click Save. A screen like this will appear.
Table properties
Congratulations!-You have created your table! The corresponding SQL command for creating these fields is also displayed. This isn't needed but in time you will start to recognise MySql commands
Note that you can use Drop to delete a table or fields.
When you are ready we suggest you check out all of the options on this page.
Inputting data into the table.
Click the tab labeled "Insert" - and another window should appear, like this.
Adding records
Now type in the details for each of the fields for this record. The "id" column was set to automatically increment so you do not need to enter a number.
Note - if you ever get lost with phpMyAdmin navigation click "Home" in the left hand nav bar and start again.
Now click Save and the record is saved to the people table.
The previous window reappears with the SQL command for the insert. You can keep adding recordsby re-selecting Insert".
For multiple records, you can select the "Insert another new row" radio button on the input form.
When you've finished entering several records into the table, you can check them by clicking on the Browse tab. You can click on individual records for editing or deleting.
browsing your table
You can use the Select tab to refine your display when your database starts grows to many pages of records.
Backup your data
You "don't know what you've got 'til its gone"!
- Click on your database name in the left hand navigation bar
- Click on EXPORT (top tab)
- Highlight the table/s you want to back up
- Select STRUCTURE and DATA radio button
- Select "Enclose table and field names with backquotes"
- Select "Save as file" and "zipped" check boxes
- Click "Go" and a zipped archive file will be generated.
Well done! - you've created a database, a table and fields, entered in a few records, viewed the records, edited and perhaps deleted some of them and practised backing up.

    Week 10 - No Class

    No Class due to Dr.Zaida on MC