Friday 21 March 2014

Refleksi Minggu ke-6

Alhamdulillah..for the 6th week, we are introduced to create the following pages :
  1. admin_login.php - as an admin login page only
  2. admin1.php - create a level 1 access
  3. admin2.php - create a level 2 access
  4. view_user.php - to view listname of users
  5. detail_user.php - to view detailed information of users
  6. update_user.php - for updating the users' informations
  7. delete_user.php - to delete users' informations
-----------------------------------------------------------------------------------------------------------
Overall the flow of the dynamic web pages as below :

admin_login.php


Fill form, Admin : admin1, password : 1111, the page as below is viewed :

admin1.php
If using Admin : admin2, password : 2222, the page as below is viewed :




Admin can view user, by clicking  View User  , then the page is viewed as below :

view_user.php

When clicking to any name, the page is viewed as below :
user_detail.php


When clicking back, the page back to view_user.php.

view_user.php


After clicking Home Admin, the page back to admin1.php

admin1.php

Admin can updating user by clicking Update
The page update_user.php will be viewed.
example : aminah ----> aminah harun


Admin 1 also can deleting user by clicking Delete
example: delete junaidah

***************************************

login_admin.php
Before creating the admin pages above, we need to create Login Admin page :
  1. Insert Form
  2. Insert 2 textfield (admin & password)
  3. Insert button, change the value of button "Login"
  4. Save as login_admin.php
  5. Don't forget to add on server behaviors > Authentication user > Login User
  6. Fill up as below.
  7. Below are the view of server behaviors panel.

Table : admin (MySQL)
Then, we need to create a new table separately for admin in MySQL:
  1. Table name : admin
  2. Using 4 types of data,
    1. id (setup as primary key and auto increment)
    2. username
    3. password
    4. level (to diffentiate between level 1 and level 2)
  3. Click Insert and fill up the value for admin 1 and admin 2 as below :
  4. Then, click 'Go'

  5. admin 1
    admin 2

admin1.php

For creating an Admin page Level 1, some server behaviour needed after creating a new table <admin> :

admin1.php
  1. Insert Div Tag, type 'Admin Level 1 Access'
  2. In the new paragraph, insert form
  3. In the form, insert table : Row (2), Column (5)
  4. Fill up and type 'View User, Add User, Update User, Delete User, Logout' in the upper row.
  5. On server behaviour, add Recordset > Choose Connection : dmx > Table : reg > OK
  6. On Bindings > dragto the cell below View User.

  7. After that, highlight second row of the table.
  8. Add 'Repeat Region' on server behaviors > All Record > OK (to view all users in the table).
============
  1. To view the users, highlight View User.
  2. Add Go To Detail Page on the server behaviors.
  3. Detail page : view_user.php (will be created and explained later)
  4. Setup Pass URL parameter : id
  5. Setup Pass existing parameter : URL parameters
============================
  1. Then, if the admin want to update the users' data, type 'Update' below the row 'Update', then highlight it.
  2. Add Go To Detail Page on the server behaviors.
  3. Detail page : update_user.php (will be created and explained later)
  4. Setup Pass URL parameter : id
  5. Setup Pass existing parameter : URL parameters

==============================
  1. Then, to delete the data, type 'Delete' below the row 'Delete', then highlight it.
  2. Add Go To Detail Page on the server behaviors.
  3. Detail page : delete.php (will be created and explained later)
  4. Setup Pass URL parameter : id
  5. Setup Pass existing parameter : URL parameters
============================

  1. To make an admin1.php restricted to all except to admin level 1 only, then we need to add Authentication User > Restrict Access To Page.
  2. Restricted based on : Username, password, and access level : 1
  3. If access denied, go to : admin2.php
  4. Below are all server behaviors appeared on the panel of admin1.php



view_user.php

  1. Insert Div Tag, type 'View User, Click on the user name to view detailed information'
  2. In the new paragraph, insert table : Row (1), Column (1)
  3. On server behaviour, add Recordset > Choose Connection : dmx > Table : reg > OK
  4. On Bindings > draginto the table.
  5. To view all the user names, highlight the table.
  6. On server behaviours, add Repeat Region> All Record > OK
  7. Then, in the new paragraph below, type 'Home Admin' and highlight it > add on Server Behaviors > Go to Related Page > admin1.php
==================

  1. To see user details, we need to highlight {Recordset1.name} and set it to the Server behaviours > Go to Detail Page > fill up as below
  2. Detail page : user_detail.php (will be explained and created later)
  3. The server behaviors added in view_user.php as shown as below :

user_detail.php
We need to create user_detail.php to view details' information after clicking the user Name.

  1. Insert Div Tag, type 'User Detail'
  2. In the new paragraph, insert table : Row (2), Column (5)
  3. Fill up the table and type 'User ID, Name, Username, Password, Email' in the first column.
  4. On server behaviour, add Recordset > Choose Connection : dmx > Table : reg > Filter : id (URL Parameter: id > Sort : id > Ascending > OK
  5. On Bindings > drag all items in Recordset into the second column.
  6. Then, to go back view_user.php, highlight Back, then link it to view_user.php
  7. The server behaviors added in user_detail.php is as shown as below :


update_user.php
We need to create update_user.php as a way to update the data.



  1. Insert Div Tag, type 'Update User'
  2. In the new paragraph, insert form
  3. In the form, insert table : Row (5), Column (2)
  4. Fill up and type 'ID, Name, Username, Password, Email' in the first column.
  5. Fill up every rows in the second column with form>textfield
  6. On server behaviour, add Recordset > Choose Connection : dmx > Table : reg > Filter : id (URL Parameter: id > Sort : id > Ascending > OK
  7. On Bindings > drag each of item in Recordset into the textfield according to the name of first column.
  8. Insert button, setup the value of button with 'Update'
  9. On server behaviors, add 'Update Record'
  10. Setup connection: dmx > Update table: reg > After updating, go to : admin1.php > OK

delete.php
Admin can delete the users by creating a delete page.
  1. Open a new blank php page
  2. On server behaviour, add Recordset > Choose Connection : dmx > Table : reg > Filter : id (URL Parameter: id > Sort : id > Ascending > OK
  3. Then, on server behaviour, add 'Delete Record'
  4. First check if variable is defined : Primary key value > Connection : dmx > Table : reg > Primary key column : id > Primary key value : URL parameter (id) > After deleting, go to : admin1.php > OK


admin2.php
Creating admin2.php has the same way to create admin1.php.
Below are the related pages needed :
  1. view_user2.php
  2. user_detail2.php
  3. update_user2.php
Below is the pages I have created.... :-) (including the last week's tasks)


As a reflection of 6th week, I think there are so many thing we can do as long as we have a server behaviour panel that helping us to make several types of pages. Even it is quite tough to learn (for me) but if we succeed creating the pages, we feel so relieved and eager to learn more insya Allah.