+++ /dev/null
-<?php \r
- session_start();\r
- switch ($_REQUEST['employeeId']) {\r
- case '1':\r
- $employee = array(\r
- "employeeId"=>1,\r
- "firstName"=>"Joe",\r
- "lastName"=>"Smith",\r
- "department"=>"Management",\r
- "title"=>"CEO",\r
- "telephone"=>"240-555-1287"\r
- );\r
- if (true == $_SESSION['isAdmin']) {\r
- $employee['homeAddress'] = array(\r
- "street"=>"123 Bluebird Ct.",\r
- "city"=>"Columbia",\r
- "state"=>"MD"\r
- );\r
- }\r
- break;\r
- case '2':\r
- $employee = array(\r
- "employeeId"=>2,\r
- "firstName"=>"George",\r
- "lastName"=>"Loram",\r
- "department"=>"Sales",\r
- "title"=>"VP of Sales",\r
- "telephone"=>"240-555-1287"\r
- );\r
- if (true == $_SESSION['isAdmin']) {\r
- $employee['homeAddress'] = array(\r
- "street"=>"283 N. Market St.",\r
- "city"=>"Frederick",\r
- "state"=>"MD"\r
- );\r
- }\r
- break;\r
- case '3':\r
- $employee = array(\r
- "employeeId"=>3,\r
- "firstName"=>"Sally",\r
- "lastName"=>"Beogagi",\r
- "department"=>"Human Resources",\r
- "title"=>"Senior Hiring Agent",\r
- "telephone"=>"443-555-1220"\r
- );\r
- if (true == $_SESSION['isAdmin']) {\r
- $employee['homeAddress'] = array(\r
- "street"=>"8923 Redwood St.",\r
- "city"=>"Ellicott City",\r
- "state"=>"MD"\r
- );\r
- }\r
- break;\r
- case '4':\r
- $employee = array(\r
- "employeeId"=>4,\r
- "firstName"=>"Billy",\r
- "lastName"=>"Diarmaid",\r
- "department"=>"Human Resources",\r
- "title"=>"Hiring Agent",\r
- "telephone"=>"443-555-2890"\r
- );\r
- if (true == $_SESSION['isAdmin']) {\r
- $employee['homeAddress'] = array(\r
- "street"=>"893 Madison St.",\r
- "city"=>"Mt. Airy",\r
- "state"=>"MD"\r
- );\r
- }\r
- break;\r
- case '5':\r
- $employee = array(\r
- "employeeId"=>5,\r
- "firstName"=>"Bruno",\r
- "lastName"=>"Domingos",\r
- "department"=>"Technology",\r
- "title"=>"CTO",\r
- "telephone"=>"443-555-2890"\r
- );\r
- if (true == $_SESSION['isAdmin']) {\r
- $employee['homeAddress'] = array(\r
- "street"=>"123 5th St.",\r
- "city"=>"Washington",\r
- "state"=>"DC"\r
- );\r
- }\r
- break; \r
- }\r
- echo json_encode($employee);\r
-?>\r