case "addEmployee": $firstName = filter_input(INPUT_POST, "firstName", FILTER_SANITIZE_STRING); $lastName = filter_input(INPUT_POST, "lastName", FILTER_SANITIZE_STRING); $phoneNumber = filter_input(INPUT_POST, "phoneNumber", FILTER_SANITIZE_STRING); $eyeColor = filter_input(INPUT_POST, "eyeColor", FILTER_SANITIZE_STRING); $weight = filter_input(INPUT_POST, "weight", FILTER_SANITIZE_STRING); $height = filter_input(INPUT_POST, "height", FILTER_SANITIZE_STRING); $age = filter_input(INPUT_POST, "age", FILTER_SANITIZE_NUMBER_INT); $hairColor = filter_input(INPUT_POST, "hairColor", FILTER_SANITIZE_STRING); $address = filter_input(INPUT_POST, "address", FILTER_SANITIZE_STRING); $empAndTraits = array('firstName' => $firstName, 'lastName' => $lastName, 'phoneNumber' => $phoneNumber, 'eyeColor' => $eyeColor, 'weight' => $weight, 'height' => $height, 'age' => $age, 'hairColor' => $hairColor, 'address' => $address); $result = addEmployee($conn, $empAndTraits); break; case "deleteEmployee": $idToDelete = filter_input(INPUT_POST, "idToDelete", FILTER_SANITIZE_STRING); $result = deleteEmployee($conn, $idToDelete); break; case "editEmployee": $idToEdit = filter_input(INPUT_POST, "idToEdit", FILTER_SANITIZE_STRING); $firstName = filter_input(INPUT_POST, "firstName", FILTER_SANITIZE_STRING); $lastName = filter_input(INPUT_POST, "lastName", FILTER_SANITIZE_STRING); $phoneNumber = filter_input(INPUT_POST, "phoneNumber", FILTER_SANITIZE_STRING); $eyeColor = filter_input(INPUT_POST, "eyeColor", FILTER_SANITIZE_STRING); $weight = filter_input(INPUT_POST, "weight", FILTER_SANITIZE_STRING); $height = filter_input(INPUT_POST, "height", FILTER_SANITIZE_STRING); $age = filter_input(INPUT_POST, "age", FILTER_SANITIZE_NUMBER_INT); $hairColor = filter_input(INPUT_POST, "hairColor", FILTER_SANITIZE_STRING); $address = filter_input(INPUT_POST, "address", FILTER_SANITIZE_STRING); $empAndTraits = array('idToEdit' => $idToEdit, 'firstName' => $firstName, 'lastName' => $lastName, 'phoneNumber' => $phoneNumber, 'eyeColor' => $eyeColor, 'weight' => $weight, 'height' => $height, 'age' => $age, 'hairColor' => $hairColor, 'address' => $address); $result = editEmployee($conn, $empAndTraits); default:
saveEmployeeJob($_POST["emp_id"], $jobs[$i]->id, $_POST["job" . $jobs[$i]->id]); } } //save employee availability deleteEmployeeAvailability($_POST["emp_id"]); for ($i = 0; $i < count($shifts); $i++) { for ($j = 1; $j <= 7; $j++) { if (isset($_POST["shift" . $shifts[$i]->name . "-" . $j])) { saveEmployeeAvailable($_POST["emp_id"], $shifts[$i]->name, $j, "1"); } } } } //delete job if ($_POST["procedure"] == "Delete") { deleteEmployee($_POST["emp_id"]); } //edit employee selected if ($_POST["procedure"] == "Edit") { $emp_id = $_POST["employees"]; loadEmployee($emp_id); $btn_text = "Edit"; } $staff = loadSortedEmployees(); ?> <br> <div class="tabs"> <ul> <li id="tab1" class="current"><span><a href="javascript:mcTabs.displayTab('tab1','panel1');" onMouseDown="return false;">Search</a></span></li>
mysql_connect("mysql18.ezhostingserver.com", "hagan", "P@ssW0rd") or die(mysql_error()); mysql_select_db("employee") or die(mysql_error()); //call if (function_exists($_GET['method'])) { echo $_GET['method']; if ($_GET['method'] = 'getAllEmployees') { if (isset($_GET['end'])) { $end = $_GET['end']; } getAllEmployees($end); } if ($_GET['method'] = 'deleteEmployee') { if (isset($_GET['id'])) { $id = $_GET['id']; } deleteEmployee($id); } } //methods function getAllEmployees($end) { $query = "select * from employees WHERE isDeleted = `0` LIMIT " . $end; $employee_sql = mysql_query($query); $employees = array(); while ($employee = mysql_fetch_assoc($employee_sql)) { $employees[] = $employee; } $employees = json_encode($employees); echo $_GET['jsoncallback'] . '(' . $employees . ')'; } function deleteEmployee($id)
pullVals($db); } else { if (isset($_POST['addField']) && !empty($_POST['addField'])) { updateForm($db); } else { if (isset($_POST['input']) && !empty($_POST['input'])) { editEmployee($db); } else { if (isset($_POST['formData']) && !empty($_POST['formData'])) { createForm($db); } else { if (isset($_POST['allVals']) && !empty($_POST['allVals'])) { submitUserCreatedForm($db); } else { if (isset($_POST) && !empty($_POST)) { deleteEmployee($db); } else { echo json_encode("There is no post and somehow you are here."); } } } } } } } } } } } } }
addDepartment(); break; case "updateDepartment": updateDepartment(); break; case "deleteDepartment": deleteDepartment(); break; case "insertEmployee": addEmployee(); break; case "updateEmployee": updateEmployee(); break; case "deleteEmployee": deleteEmployee(); break; case "insertLocation": addLocation(); break; case "updateLocation": updateLocation(); break; case "deleteLocation": deleteLocation(); break; } displayHeader(); // Show HTML header displayNavigation(); // Show Navigation