Friday, March 21, 2014

WEEK 6

LOGIN ADMIN PAGE

Create File > New > Blank Page > PHP > Create

Insert Form

Insert Table, 2 row and 2 column

Type ‘username’ and ‘password’ at each column

Edit the text field

Put button at the bottom of the table and name the button as Login

Choose submit button at the action

Go to panel server behaviours > Click User Authentication > Click Login User

Connection : dmx
Table : admin
Username : username
Password : password
If success : Go to admin1.php
If fail : Go to admin_fail.php

Choose username, password, access level
Get level from ‘level’



Save this page as ‘admin_login.php’




ADMIN1 VIEW

Create File > New > Blank Page > PHP > Create
Insert Div Text
Insert Table, 2 row and 5 column
Type “view user”, “add user “, ‘delete user”, “update user” and “logout”
Save this file as “admin1.php”



ADMIN2 VIEW

Create File > New > Blank Page > PHP > Create
Insert Div Text
Insert Table, 2 row and 3 column
Type “view user”, “add user” and “logout”
Save this file as “admin2.php”



INSERT RESTRICT ACCESS

Open admin1.php file
Go to server behaviour > Click User Authentication > Restrict Access to Page
Restrict based on username, password and access level
Define
Name: 1 > ok
If access denied go to admin2.php



GO TO DETAIL PAGE

Create > File > New > Blank Page > PHP > Create
Click Layout > Insert Div Text
Type : ADMIN VIEW USER
Go to Panel Binding > Click Recordset
Connection : dmx
Table : register
Click ok

Drag username to the page
Highlight the username that has been dragged > click server behaviour > repeat region
Save the file as “view _user.php”
Highlight again the username > Go to server behaviour > Go to Detail Page > Fill up pop up box
Detail Page : Detail Page
Pass URL parameter : id
Tick both URL parameter and form parameter > click ok

CREATE DETAIL PAGE

File > New > Blank Page > PHP > Create
Layout > Insert Div Text
Type : USER DETAIL
Insert table: 5 row, 2 column
Type userid, surname, firstname, username and password at each column
Go to Panel Binding > Recordset (Query)
Connection : dmx
Table : register
Filter : id
Sort by : id and ascending
Do the drag process “id go to user id column and so on
Create ‘Back” button
Highlight the button and link to ‘view_user.php’
Save the file as ‘detail.php’



Open file admin1.php
Highlight view user > link it to “view_user.php”
Click Save
Open admin_login.php and preview in firefox




UPDATE USER

File > New > Blank Page > PHP > Create
Layout > Insert Div Text
Click Form > Insert Table > Row 5, Column 2
Type username , surname, firstname, username and password. Dont forget to put text field in each column
Insert button > change the value and name it as “Update”
Choose submit form at the action
Save the file as “update_user.php”

Go to Panel Binding > Recordset (query)
Connection : dmx
Table : register
Click ok
Do the drag process as usual and put in the text field
Go to Panel server behaviour > Update record
Connection : dmx
Table : Register
After updating : Go to admin1.php
Save the file


CREATE ADMIN EDIT PAGE

File > New > Blank Page > PHP > Create
Insert Table > 3 column, 2 row
Go to Panel Binding > Recordset Query
Connection : dmx
Table : register
Click ok
Drag username at username column
Highlight the table > Go to server behaviour > Go to detail page >
Detail page : update_user.php
Tick URL parameter

Now open file update_user.php
Go to binding > recordset > filter id > ok
Save the file as “admin_edit.php”
Open admin_edit.php and preview in firefox


DELETE BEHAVIOR

Open Admin_edit.php file
Insert form at Delete Column
Insert button and name it to delete
Put a cursor next to delete button
Go to form > hidden field>
Edit properties bar
Edit to hd_del  and choose id as value
Go to server behaviour > Delete record
Connection : dmx
Table : register
Primary key value : Form variable, hd_del
After deleting go to : admin_edit.php
Click ok








No comments:

Post a Comment