les09 page handling tm





Handling Requests










The interactions in this eCourse require Javascript to be enabled.



 

Handling Requests


previous|next





The hr.php file contains all the PHP application Web page request and response handling logic. The logic uses the PHP session_start() function to store data as session state. Session state is used to track that the user has logged on and off, and for database error messages.
The request handling logic depends on an HTTP request parameter, called do, whose value is used to determine the next page to be displayed.
When a user first requests the hr.php page, the do HTTP parameter is not provided. Because the user has not logged in, the loggedin session parameter is not set. Therefore, the request handler calls the do_login() function to display the login page.
Here is the page-handling logic:
if (!isset($_REQUEST['do']) && !ui_islogged_in()) {
do_login();
}
else {
$doreq = isset($_REQUEST['do']) ? $_REQUEST['do'] : "showdept";
if ($doreq == "logout") {
do_logout();
}
elseif ($doreq == "showemp") {
construct_employees();
}
else {
construct_departments();
}
}
After the user has successfully logged in, an HTTP request without the do parameter causes the department information to be displayed. Otherwise, when the do HTTP parameter is:




logout, the user session is terminated and a logout page is displayed



showemp, the employees in the specified department are displayed. The department ID is obtained from an HTTP request parameter in the construct_employees() function.











Wyszukiwarka

Podobne podstrony:
les09 cre ui tm
les09 disp?pt tm
les09 create? logic tm
les09 crectl logic tm
les09 credb connect tm
les09 get?pt tm
les09 get emp tm
les09 cregen query tm
les09 disp emp tm
les09 login page tm
les09 logout page tm
les09 create? conn prop tm
les09 getstart tm
page$
page&

więcej podobnych podstron