コード例 #1
1
include_once 'SQLSafe.php';
$SQLSafe = new SQLSafe();
/**
 * Created by PhpStorm.
 * User: lenovo
 * Date: 2015/11/16
 * Time: 19:39
 */
$name = $_POST['employeeName'];
$sex = $_POST['sex'];
$phone = $_POST['phone'];
$birthDay = $_POST['birthDay'];
$degreeID = $_POST['degreeID'];
$departmentID = $_POST['departmentID'];
$title = $_POST['title'];
$salary = $_POST['salary'];
$employeeTypeID = $_POST['employeeTypeID'];
$hireDate = $_POST['hireDate'];
function addEmployee($name, $sex, $phone, $birthDay, $degreeID, $departmentID, $title, $salary, $employeeTypeID, $hireDate)
{
    $conn = tools::connectDatabase();
    $ID = tools::getMaxEmployeeID() + 1;
    try {
        mysqli_query($conn, "INSERT INTO Employees(EmployeeID,EmployeeName,Sex,BirthDay,Phone,DegreeID,HireDate,EmployeeTypeID,DepartmentID,Title,Salary,ManagerID) VALUES ('{$ID}','{$name}','{$sex}','{$birthDay}','{$phone}','{$degreeID}','{$hireDate}','{$employeeTypeID}','{$departmentID}','{$title}','{$salary}','53130301'); ");
    } catch (Exception $e) {
        echo $e->getMessage();
    }
    echo "success";
}
addEmployee($name, $sex, $phone, $birthDay, $degreeID, $departmentID, $title, $salary, $employeeTypeID, $hireDate);
コード例 #2
0
ファイル: select.php プロジェクト: alexgimson86/employee_data
switch ($action) {
    case "showAllRows":
        $result = showAllRows($conn);
        break;
    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);
コード例 #3
0
ファイル: manageUsers.php プロジェクト: kumarkvk/kumar_shifts
session_start();
require "database/connect.php";
require "database/common.php";
require "database/employees.php";
require "database/jobs.php";
require "database/jobShifts.php";
require "database/schedule.php";
require "includes/common.php";
$pageTitle = "Manage Employees";
$javascript = "manageUsers.js";
require "includes/adminHeader.php";
$jobs = buildJobArray();
$shifts = loadJobShifts();
//add employee
if ($_POST["procedure"] == "ADD") {
    $empID = addEmployee($_POST["first"], $_POST["last"], $_POST["jobs"], $_POST["hours"], $_POST["address"], $_POST["phone"], $_POST["email"]);
    if ($_POST["loginID"] > "") {
        saveLogin($empID, $_POST["loginID"], $_POST["loginPassword"]);
        $body = "Your account has been created / edited.<br>Username: "******"loginID"] . "<br>Password: "******"loginPassword"];
        //mail("*****@*****.**","Shift Scheduler Account Created", $body);
    }
    //add employee jobs
    for ($i = 0; $i < count($jobs); $i++) {
        if (isset($_POST["job" . $jobs[$i]->id]) && $_POST["job" . $jobs[$i]->id] > "0") {
            saveEmployeeJob($empID, $jobs[$i]->id, $_POST["job" . $jobs[$i]->id]);
        }
    }
    //save employee availability
    for ($i = 0; $i < count($shifts); $i++) {
        for ($j = 1; $j <= 7; $j++) {
            if (isset($_POST["shift" . $shifts[$i]->name . "-" . $j])) {
コード例 #4
0
ファイル: index.php プロジェクト: IcyPalm/HanzeContact
     updateJob();
     break;
 case "deleteJob":
     deleteJob();
     break;
 case "insertDepartment":
     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();