loadEmployeeInfo.php
2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
session_start();
switch ($_REQUEST['employeeId']) {
case '1':
$employee = array(
"employeeId"=>1,
"firstName"=>"Joe",
"lastName"=>"Smith",
"department"=>"Management",
"title"=>"CEO",
"telephone"=>"240-555-1287"
);
if (true == $_SESSION['isAdmin']) {
$employee['homeAddress'] = array(
"street"=>"123 Bluebird Ct.",
"city"=>"Columbia",
"state"=>"MD"
);
}
break;
case '2':
$employee = array(
"employeeId"=>2,
"firstName"=>"George",
"lastName"=>"Loram",
"department"=>"Sales",
"title"=>"VP of Sales",
"telephone"=>"240-555-1287"
);
if (true == $_SESSION['isAdmin']) {
$employee['homeAddress'] = array(
"street"=>"283 N. Market St.",
"city"=>"Frederick",
"state"=>"MD"
);
}
break;
case '3':
$employee = array(
"employeeId"=>3,
"firstName"=>"Sally",
"lastName"=>"Beogagi",
"department"=>"Human Resources",
"title"=>"Senior Hiring Agent",
"telephone"=>"443-555-1220"
);
if (true == $_SESSION['isAdmin']) {
$employee['homeAddress'] = array(
"street"=>"8923 Redwood St.",
"city"=>"Ellicott City",
"state"=>"MD"
);
}
break;
case '4':
$employee = array(
"employeeId"=>4,
"firstName"=>"Billy",
"lastName"=>"Diarmaid",
"department"=>"Human Resources",
"title"=>"Hiring Agent",
"telephone"=>"443-555-2890"
);
if (true == $_SESSION['isAdmin']) {
$employee['homeAddress'] = array(
"street"=>"893 Madison St.",
"city"=>"Mt. Airy",
"state"=>"MD"
);
}
break;
case '5':
$employee = array(
"employeeId"=>5,
"firstName"=>"Bruno",
"lastName"=>"Domingos",
"department"=>"Technology",
"title"=>"CTO",
"telephone"=>"443-555-2890"
);
if (true == $_SESSION['isAdmin']) {
$employee['homeAddress'] = array(
"street"=>"123 5th St.",
"city"=>"Washington",
"state"=>"DC"
);
}
break;
}
echo json_encode($employee);
?>